@revolugo/elements 5.26.2-beta.14 → 5.26.2-beta.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. package/dist/{revolugo.banktransferdetails.DocOw_1c.min.js → revolugo.banktransferdetails.tjpmZWCu.min.js} +11 -11
  2. package/dist/{revolugo.bdaterangepicker.BfCLnYf4.min.js → revolugo.bdaterangepicker.1BfRFl9n.min.js} +12 -12
  3. package/dist/{revolugo.bformattedamount.CphqBbVa.min.js → revolugo.bformattedamount.jRDqB-vb.min.js} +3 -3
  4. package/dist/{revolugo.bhotelroomsdetails.DqGJ2w9u.min.js → revolugo.bhotelroomsdetails.C4sZBusG.min.js} +6 -6
  5. package/dist/{revolugo.bhotelsearchbar.BK8hTfTf.min.js → revolugo.bhotelsearchbar.cAB1sy0L.min.js} +17 -17
  6. package/dist/{revolugo.bookingdetailssidebar.DeVlYfpn.min.js → revolugo.bookingdetailssidebar.B60gyDLy.min.js} +13 -13
  7. package/dist/{revolugo.bookingdetailssidebar.B593LGvp.min.js → revolugo.bookingdetailssidebar.YjbkMSHd.min.js} +4 -4
  8. package/dist/{revolugo.bookingmanager.CoZl8iLL.min.js → revolugo.bookingmanager.CHMr94ZY.min.js} +22 -22
  9. package/dist/{revolugo.bphoneinput.BxUu-ijr.min.js → revolugo.bphoneinput.B1Ftczzi.min.js} +5 -5
  10. package/dist/{revolugo.bpricesummaryskeleton.Dtg-xXRI.min.js → revolugo.bpricesummaryskeleton.BiFHozvG.min.js} +4 -4
  11. package/dist/{revolugo.breakpoint-service.DOI2pMPe.min.js → revolugo.breakpoint-service.DwfYwy5L.min.js} +3 -3
  12. package/dist/{revolugo.bstarrating.D3SX-Y_G.min.js → revolugo.bstarrating.DjxoBeJd.min.js} +6 -6
  13. package/dist/{revolugo.btag.DLJO-aT6.min.js → revolugo.btag.Ei9wFNy1.min.js} +7 -7
  14. package/dist/{revolugo.cancellationpoliciesbadge.D_0pbCAp.min.js → revolugo.cancellationpoliciesbadge.C9l85_h_.min.js} +7 -7
  15. package/dist/{revolugo.cancellationpoliciesbadge.C8VP4uTt.min.js → revolugo.cancellationpoliciesbadge.DXP6YDah.min.js} +4 -4
  16. package/dist/{revolugo.cancellationpolicieslist.D1gpvf7i.min.js → revolugo.cancellationpolicieslist.DKzWnFZs.min.js} +3 -3
  17. package/dist/{revolugo.cancellationpolicieslist.BOgJKzJk.min.js → revolugo.cancellationpolicieslist.DQPYLD1X.min.js} +4 -4
  18. package/dist/{revolugo.common.CwuM5BCx.min.js → revolugo.common.ovDYv7Pt.min.js} +2 -2
  19. package/dist/{revolugo.creditcardform.bvLmN2Gb.min.js → revolugo.creditcardform.B_3Czeuh.min.js} +4 -4
  20. package/dist/{revolugo.creditcardform.CSujLNnM.min.js → revolugo.creditcardform.D7tbFSmL.min.js} +14 -14
  21. package/dist/{revolugo.creditcardpayment.BEHuehMJ.min.js → revolugo.creditcardpayment.ALQsB7KN.min.js} +15 -15
  22. package/dist/{revolugo.creditcardpayment.B84JmY-8.min.js → revolugo.creditcardpayment.C4VnI0jA.min.js} +4 -4
  23. package/dist/{revolugo.currencypicker.CFWpc8HP.min.js → revolugo.currencypicker.VOHpEA1m.min.js} +9 -9
  24. package/dist/{revolugo.currencypickerbtn.CTKGs5cu.min.js → revolugo.currencypickerbtn.BDd5PaTp.min.js} +4 -4
  25. package/dist/{revolugo.currencypickerbtn.BrWkrEu_.min.js → revolugo.currencypickerbtn.kW_mpe_H.min.js} +9 -9
  26. package/dist/{revolugo.dialog-attach.UdO3NAXU.min.js → revolugo.dialog-attach.DmW3pVbE.min.js} +2 -2
  27. package/dist/{revolugo.fastbookingflow.BQbWB4Dg.min.js → revolugo.fastbookingflow.DrBXpSea.min.js} +4 -4
  28. package/dist/{revolugo.fullbookingflow.JpT0NatO.min.js → revolugo.fullbookingflow.BKK4s4UB.min.js} +18 -18
  29. package/dist/{revolugo.hotel-offer.CZKaMpOK.min.js → revolugo.hotel-offer.CNljBQ0B.min.js} +13 -13
  30. package/dist/{revolugo.hoteldescriptionview.BW-zc1Gb.min.js → revolugo.hoteldescriptionview.CtJqOcXz.min.js} +24 -24
  31. package/dist/{revolugo.hoteldescriptionview.B9Yn63hn.min.js → revolugo.hoteldescriptionview.DZxXyCN1.min.js} +4 -4
  32. package/dist/{revolugo.hotelofferitemlayout.D9HQ7eD3.min.js → revolugo.hotelofferitemlayout.B762pYrv.min.js} +8 -8
  33. package/dist/{revolugo.hotelofferlist.DYCl-oA5.min.js → revolugo.hotelofferlist.5Ji9khs_.min.js} +4 -4
  34. package/dist/revolugo.hotelofferlist.B2R9QfQ0.min.js +3618 -0
  35. package/dist/{revolugo.hotelofferrequestcreator.CRa8Vkk3.min.js → revolugo.hotelofferrequestcreator.BM-4lOrZ.min.js} +4 -4
  36. package/dist/{revolugo.hoteloffersearchmenu.Bvy7ThBD.min.js → revolugo.hoteloffersearchmenu.awn72UoS.min.js} +6 -6
  37. package/dist/{revolugo.hoteloffersmap.Tvits78R.min.js → revolugo.hoteloffersmap.Coiyiggx.min.js} +18 -18
  38. package/dist/{revolugo.hoteloffersmap.Be-WCioi.min.js → revolugo.hoteloffersmap.DbBK9ZyF.min.js} +4 -4
  39. package/dist/{revolugo.hoteloffersview.CecgCs3H.min.js → revolugo.hoteloffersview.Bxq0_cw_.min.js} +4 -4
  40. package/dist/{revolugo.hoteloffersview.Brgrm79v.min.js → revolugo.hoteloffersview.D2b4Dz6Z.min.js} +17 -17
  41. package/dist/{revolugo.hotelroomofferlist.Nd4YwBo_.min.js → revolugo.hotelroomofferlist.Qsx54sYI.min.js} +4 -4
  42. package/dist/{revolugo.hotelroomofferlist.C8FRyEq_.min.js → revolugo.hotelroomofferlist.itCenyDY.min.js} +28 -28
  43. package/dist/{revolugo.hotelroomofferrequestcreator.B5lVTZZd.min.js → revolugo.hotelroomofferrequestcreator.BHRtwusf.min.js} +4 -4
  44. package/dist/{revolugo.hotelroomoffersbookingflow.i2t1vPgD.min.js → revolugo.hotelroomoffersbookingflow.qWULA0F-.min.js} +19 -19
  45. package/dist/{revolugo.hotelroomoffersearchmenu.PApWToHT.min.js → revolugo.hotelroomoffersearchmenu.C2_2xVQu.min.js} +5 -5
  46. package/dist/{revolugo.hotelroomoffersearchmenu.CMsc-CNV.min.js → revolugo.hotelroomoffersearchmenu.DMzh7DMJ.min.js} +4 -4
  47. package/dist/{revolugo.hotelroomoffersview.Cw6aKuIO.min.js → revolugo.hotelroomoffersview.29UPqTkW.min.js} +12 -12
  48. package/dist/{revolugo.hotelroomoffersview.2ltsp5_R.min.js → revolugo.hotelroomoffersview.CcSzPtRd.min.js} +4 -4
  49. package/dist/{revolugo.i18n.BEhtXca3.min.js → revolugo.i18n.USNClftL.min.js} +3 -3
  50. package/dist/{revolugo.index.Dp01frUM.min.js → revolugo.index.B2N9qsdI.min.js} +2 -2
  51. package/dist/revolugo.index.BTjlc9ZK.min.js +15 -0
  52. package/dist/{revolugo.index.CJ17FP0k.min.js → revolugo.index.BluAa6bn.min.js} +5 -5
  53. package/dist/{revolugo.index.5uzTM8jR.min.js → revolugo.index.BsxLt_mb.min.js} +2 -2
  54. package/dist/{revolugo.index.B12-gJPR.min.js → revolugo.index.C0OpnCZi.min.js} +7 -7
  55. package/dist/{revolugo.index.CS2-Q-ND.min.js → revolugo.index.CB7ogzk6.min.js} +6 -6
  56. package/dist/{revolugo.index.vww3SoWt.min.js → revolugo.index.CSsb0wKA.min.js} +5 -5
  57. package/dist/{revolugo.index.B8vp5hk7.min.js → revolugo.index.DNtO6t9k.min.js} +3 -3
  58. package/dist/{revolugo.index.mn1Z4_fN.min.js → revolugo.index.DUPpGirx.min.js} +3 -3
  59. package/dist/{revolugo.index.B91957iL.min.js → revolugo.index.OcIEgjTb.min.js} +3 -3
  60. package/dist/{revolugo.index.C8Z7BwW8.min.js → revolugo.index.ap6OVVgC.min.js} +2 -2
  61. package/dist/{revolugo.index.Dv25a8IA.min.js → revolugo.index.aw1R8MGN.min.js} +4 -4
  62. package/dist/{revolugo.index.CuzC7huw.min.js → revolugo.index.bu5Te_sP.min.js} +6 -6
  63. package/dist/{revolugo.index.Bm7Hekqn.min.js → revolugo.index.ihcJPVXG.min.js} +5 -5
  64. package/dist/{revolugo.langpicker.CBhHqEv3.min.js → revolugo.langpicker.CTsr9ahO.min.js} +7 -7
  65. package/dist/{revolugo.langpickerbtn.CCFKqTpQ.min.js → revolugo.langpickerbtn.3f7krE22.min.js} +10 -10
  66. package/dist/{revolugo.langpickerbtn.LR2vizK2.min.js → revolugo.langpickerbtn.BuJ5ScZp.min.js} +4 -4
  67. package/dist/revolugo.min.js +26 -26
  68. package/dist/{revolugo.parsed-height.DpcziUUJ.min.js → revolugo.parsed-height.D7Bem5XU.min.js} +40 -40
  69. package/dist/{revolugo.parsed-props.CQJFjK9a.min.js → revolugo.parsed-props.6C6bTcBm.min.js} +3 -3
  70. package/dist/{revolugo.prebookform.BhFn4px0.min.js → revolugo.prebookform.DF0LLE0h.min.js} +4 -4
  71. package/dist/{revolugo.prebookform.DGlhRyr3.min.js → revolugo.prebookform.fAmgWZRX.min.js} +18 -18
  72. package/dist/{revolugo.revolugo-config.Cd_JnGq0.min.js → revolugo.revolugo-config.DPrBbf0u.min.js} +3 -3
  73. package/dist/{revolugo.roominglisteditor.wX75dXlM.min.js → revolugo.roominglisteditor.Bbv4VkLQ.min.js} +10 -10
  74. package/dist/{revolugo.roominglisteditor.eWCwVydd.min.js → revolugo.roominglisteditor.CFJCzXSV.min.js} +4 -4
  75. package/dist/{revolugo.sentry.DqPFRxU3.min.js → revolugo.sentry.tKmu60kY.min.js} +2 -2
  76. package/dist/{revolugo.store.dZMoiQlF.min.js → revolugo.store.Dzne136x.min.js} +3 -3
  77. package/dist/{revolugo.storybooktoolbar.DnfXFFIc.min.js → revolugo.storybooktoolbar.CP_6AUAT.min.js} +16 -16
  78. package/dist/{revolugo.termsandconditions.Dfu_0rOp.min.js → revolugo.termsandconditions.DgblkJ-o.min.js} +6 -6
  79. package/dist/{revolugo.termsandconditions.DLFKBpfw.min.js → revolugo.termsandconditions.XxH9jt9l.min.js} +4 -4
  80. package/dist/revolugo.typed-mixins.D7cv-gw1.min.js +8 -0
  81. package/dist/{revolugo.valert.88ZHPGhT.min.js → revolugo.valert.Ch9tTzUm.min.js} +7 -7
  82. package/dist/{revolugo.vautocomplete.WFeBr6qP.min.js → revolugo.vautocomplete.C4hhNJvB.min.js} +5 -5
  83. package/dist/{revolugo.vbadge.COTjzWmJ.min.js → revolugo.vbadge.-u7e2ov4.min.js} +6 -6
  84. package/dist/{revolugo.vbtn.DO8W7N0r.min.js → revolugo.vbtn.DLby6dZM.min.js} +7 -7
  85. package/dist/{revolugo.vcard.gQH1l9-J.min.js → revolugo.vcard.w2TZpeTi.min.js} +6 -6
  86. package/dist/{revolugo.vdialog.B39hW_QQ.min.js → revolugo.vdialog.DvEDArBK.min.js} +7 -7
  87. package/dist/{revolugo.vexpansionpanelheader.ADoud6DV.min.js → revolugo.vexpansionpanelheader.DLtLqeZW.min.js} +8 -8
  88. package/dist/{revolugo.vform.721jx4in.min.js → revolugo.vform.D7H_APqS.min.js} +5 -5
  89. package/dist/{revolugo.vinput.DHB-qqO8.min.js → revolugo.vinput.fh1DpTt_.min.js} +5 -5
  90. package/dist/{revolugo.vitemgroup.en0tJeuk.min.js → revolugo.vitemgroup.DA8DGKgA.min.js} +5 -5
  91. package/dist/{revolugo.vlistitem.CUA8VxiW.min.js → revolugo.vlistitem.D7AU-4_k.min.js} +6 -6
  92. package/dist/{revolugo.vmenu.CM59ObZV.min.js → revolugo.vmenu.DTS8hoIP.min.js} +8 -8
  93. package/dist/{revolugo.vselect.CZT6j54N.min.js → revolugo.vselect.BDvmVYMM.min.js} +15 -15
  94. package/dist/{revolugo.vsheet.Ci8EFagN.min.js → revolugo.vsheet.Bmz2rGrG.min.js} +5 -5
  95. package/dist/{revolugo.vskeletonloader.B8WWRpEn.min.js → revolugo.vskeletonloader.CmMbqMPd.min.js} +4 -4
  96. package/dist/{revolugo.vslidegroup.DZ44OZy2.min.js → revolugo.vslidegroup.CpnnazjF.min.js} +10 -10
  97. package/dist/{revolugo.vsnackbar.hQQeV8CP.min.js → revolugo.vsnackbar.DKPXGk20.min.js} +5 -5
  98. package/dist/{revolugo.vtextfield.uC2GWAXb.min.js → revolugo.vtextfield.BEoLwZEZ.min.js} +7 -7
  99. package/dist/{revolugo.vtoolbar.CKpQ7I-2.min.js → revolugo.vtoolbar.BEyMYKDD.min.js} +5 -5
  100. package/dist/{revolugo.vtooltip.vt1MeNsi.min.js → revolugo.vtooltip.CTfm4Bzw.min.js} +5 -5
  101. package/dist/{revolugo.vuetify.CUwfJUZL.min.js → revolugo.vuetify.BEnMa6lA.min.js} +3 -3
  102. package/dist/{revolugo.watch-list.DZXZ9UBF.min.js → revolugo.watch-list.CTIegeD8.min.js} +3 -3
  103. package/dist/{revolugo.webcomponentwrapper.BGRSC-LW.min.js → revolugo.webcomponentwrapper.CslhptVC.min.js} +5 -5
  104. package/package.json +3 -3
  105. package/dist/revolugo.hotelofferlist.D-RL29DF.min.js +0 -4191
  106. package/dist/revolugo.index.8asECxdn.min.js +0 -15
  107. package/dist/revolugo.typed-mixins.CXF5T_Lk.min.js +0 -8
@@ -1,4191 +0,0 @@
1
- var Ds = Object.defineProperty;
2
- var ks = (n, e, t) => e in n ? Ds(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var A = (n, e, t) => ks(n, typeof e != "symbol" ? e + "" : e, t);
4
- import { s as Cs } from "./revolugo.revolugo-config.Cd_JnGq0.min.js";
5
- import { g as Z, a as Ns, d as Ie } from "./revolugo.store.dZMoiQlF.min.js";
6
- import { h as Ps, H as Ls } from "./revolugo.hotelofferrequestcreator.CRa8Vkk3.min.js";
7
- import { H as ws, B as $s, p as Ms, b as Us, c as Bs } from "./revolugo.parsed-height.DpcziUUJ.min.js";
8
- import { H as An } from "./revolugo.hotelofferitemlayout.D9HQ7eD3.min.js";
9
- import { Z as xs, V as Dn, Y as de, a as Fs } from "./revolugo.i18n.BEhtXca3.min.js";
10
- import { B as Hs, _ as Gs } from "./revolugo.bphoneinput.BxUu-ijr.min.js";
11
- import { l as Nt, n as Pt, _ as Ne, a as le, B as Vs } from "./revolugo.webcomponentwrapper.BGRSC-LW.min.js";
12
- import { _ as js } from "./revolugo.vform.721jx4in.min.js";
13
- import { _ as Te } from "./revolugo.vtextfield.uC2GWAXb.min.js";
14
- import { _ as Gt } from "./revolugo.vmenu.CM59ObZV.min.js";
15
- import { a as Vt, _ as Ks } from "./revolugo.bdaterangepicker.BfCLnYf4.min.js";
16
- import { _ as Lt } from "./revolugo.vbtn.DO8W7N0r.min.js";
17
- import { b as kn } from "./revolugo.breakpoint-service.DOI2pMPe.min.js";
18
- import { _ as Et, p as qs } from "./revolugo.parsed-props.CQJFjK9a.min.js";
19
- import { H as Qs } from "./revolugo.hotelroomofferlist.C8FRyEq_.min.js";
20
- import { B as Ws } from "./revolugo.bhotelsearchbar.BK8hTfTf.min.js";
21
- import { w as Xs } from "./revolugo.watch-list.DZXZ9UBF.min.js";
22
- import { t as zs } from "./revolugo.typed-mixins.CXF5T_Lk.min.js";
23
- import { T as Ys } from "./revolugo.termsandconditions.Dfu_0rOp.min.js";
24
- import { _ as Js } from "./revolugo.index.B12-gJPR.min.js";
25
- const Zs = {
26
- FiltersBar: !0,
27
- HotelOfferSearchMenu: !1,
28
- TermsAndConditionsFooter: !0,
29
- HotelOfferItem: ws
30
- }, er = {
31
- ...Ps,
32
- features: {
33
- default: () => Zs,
34
- type: [Object, String]
35
- },
36
- height: {
37
- default: "600px",
38
- type: [Number, String]
39
- },
40
- hotelRoomOffersLimit: {
41
- type: Number
42
- },
43
- loadingBarEnabled: {
44
- type: Boolean,
45
- default: !0
46
- },
47
- limit: {
48
- type: Number,
49
- default: xs
50
- },
51
- maxHeight: {
52
- default: "90vh",
53
- type: [Number, String]
54
- },
55
- rounded: {
56
- type: Boolean,
57
- default: !0
58
- }
59
- };
60
- function D(n) {
61
- return n != null && typeof n == "object" && n["@@functional/placeholder"] === !0;
62
- }
63
- function Y(n) {
64
- return function e(t) {
65
- return arguments.length === 0 || D(t) ? e : n.apply(this, arguments);
66
- };
67
- }
68
- function te(n) {
69
- return function e(t, s) {
70
- switch (arguments.length) {
71
- case 0:
72
- return e;
73
- case 1:
74
- return D(t) ? e : Y(function(r) {
75
- return n(t, r);
76
- });
77
- default:
78
- return D(t) && D(s) ? e : D(t) ? Y(function(r) {
79
- return n(r, s);
80
- }) : D(s) ? Y(function(r) {
81
- return n(t, r);
82
- }) : n(t, s);
83
- }
84
- };
85
- }
86
- function wt(n) {
87
- return function e(t, s, r) {
88
- switch (arguments.length) {
89
- case 0:
90
- return e;
91
- case 1:
92
- return D(t) ? e : te(function(i, a) {
93
- return n(t, i, a);
94
- });
95
- case 2:
96
- return D(t) && D(s) ? e : D(t) ? te(function(i, a) {
97
- return n(i, s, a);
98
- }) : D(s) ? te(function(i, a) {
99
- return n(t, i, a);
100
- }) : Y(function(i) {
101
- return n(t, s, i);
102
- });
103
- default:
104
- return D(t) && D(s) && D(r) ? e : D(t) && D(s) ? te(function(i, a) {
105
- return n(i, a, r);
106
- }) : D(t) && D(r) ? te(function(i, a) {
107
- return n(i, s, a);
108
- }) : D(s) && D(r) ? te(function(i, a) {
109
- return n(t, i, a);
110
- }) : D(t) ? Y(function(i) {
111
- return n(i, s, r);
112
- }) : D(s) ? Y(function(i) {
113
- return n(t, i, r);
114
- }) : D(r) ? Y(function(i) {
115
- return n(t, s, i);
116
- }) : n(t, s, r);
117
- }
118
- };
119
- }
120
- function Ge(n, e) {
121
- return Object.prototype.hasOwnProperty.call(e, n);
122
- }
123
- var tr = /* @__PURE__ */ Y(function(e) {
124
- return e === null ? "Null" : e === void 0 ? "Undefined" : Object.prototype.toString.call(e).slice(8, -1);
125
- });
126
- function jt(n) {
127
- return Object.prototype.toString.call(n) === "[object Object]";
128
- }
129
- const nr = Number.isInteger || function(e) {
130
- return e << 0 === e;
131
- };
132
- function sr(n) {
133
- return Object.prototype.toString.call(n) === "[object String]";
134
- }
135
- function rr(n, e) {
136
- var t = n < 0 ? e.length + n : n;
137
- return sr(e) ? e.charAt(t) : e[t];
138
- }
139
- function ir(n) {
140
- return new RegExp(n.source, n.flags ? n.flags : (n.global ? "g" : "") + (n.ignoreCase ? "i" : "") + (n.multiline ? "m" : "") + (n.sticky ? "y" : "") + (n.unicode ? "u" : "") + (n.dotAll ? "s" : ""));
141
- }
142
- function Cn(n, e, t) {
143
- if (t || (t = new ar()), or(n))
144
- return n;
145
- var s = function(i) {
146
- var a = t.get(n);
147
- if (a)
148
- return a;
149
- t.set(n, i);
150
- for (var l in n)
151
- Object.prototype.hasOwnProperty.call(n, l) && (i[l] = Cn(n[l], !0, t));
152
- return i;
153
- };
154
- switch (tr(n)) {
155
- case "Object":
156
- return s(Object.create(Object.getPrototypeOf(n)));
157
- case "Array":
158
- return s(Array(n.length));
159
- case "Date":
160
- return new Date(n.valueOf());
161
- case "RegExp":
162
- return ir(n);
163
- case "Int8Array":
164
- case "Uint8Array":
165
- case "Uint8ClampedArray":
166
- case "Int16Array":
167
- case "Uint16Array":
168
- case "Int32Array":
169
- case "Uint32Array":
170
- case "Float32Array":
171
- case "Float64Array":
172
- case "BigInt64Array":
173
- case "BigUint64Array":
174
- return n.slice();
175
- default:
176
- return n;
177
- }
178
- }
179
- function or(n) {
180
- var e = typeof n;
181
- return n == null || e != "object" && e != "function";
182
- }
183
- var ar = /* @__PURE__ */ function() {
184
- function n() {
185
- this.map = {}, this.length = 0;
186
- }
187
- return n.prototype.set = function(e, t) {
188
- var s = this.hash(e), r = this.map[s];
189
- r || (this.map[s] = r = []), r.push([e, t]), this.length += 1;
190
- }, n.prototype.hash = function(e) {
191
- var t = [];
192
- for (var s in e)
193
- t.push(Object.prototype.toString.call(e[s]));
194
- return t.join();
195
- }, n.prototype.get = function(e) {
196
- if (this.length <= 180) {
197
- for (var t in this.map)
198
- for (var a = this.map[t], s = 0; s < a.length; s += 1) {
199
- var r = a[s];
200
- if (r[0] === e)
201
- return r[1];
202
- }
203
- return;
204
- }
205
- var i = this.hash(e), a = this.map[i];
206
- if (a)
207
- for (var s = 0; s < a.length; s += 1) {
208
- var r = a[s];
209
- if (r[0] === e)
210
- return r[1];
211
- }
212
- }, n;
213
- }(), S = /* @__PURE__ */ Y(function(e) {
214
- return e != null && typeof e.clone == "function" ? e.clone() : Cn(e);
215
- });
216
- function lr(n, e) {
217
- for (var t = e, s = 0; s < n.length; s += 1) {
218
- if (t == null)
219
- return;
220
- var r = n[s];
221
- nr(r) ? t = rr(r, t) : t = t[r];
222
- }
223
- return t;
224
- }
225
- var cr = /* @__PURE__ */ wt(function(e, t, s) {
226
- var r = {}, i;
227
- t = t || {}, s = s || {};
228
- for (i in t)
229
- Ge(i, t) && (r[i] = Ge(i, s) ? e(i, t[i], s[i]) : t[i]);
230
- for (i in s)
231
- Ge(i, s) && !Ge(i, r) && (r[i] = s[i]);
232
- return r;
233
- }), ur = /* @__PURE__ */ wt(function n(e, t, s) {
234
- return cr(function(r, i, a) {
235
- return jt(i) && jt(a) ? n(e, i, a) : e(r, i, a);
236
- }, t, s);
237
- }), dr = /* @__PURE__ */ wt(function(e, t, s) {
238
- return ur(function(r, i, a) {
239
- return e(i, a);
240
- }, t, s);
241
- }), fr = /* @__PURE__ */ te(lr), Nn = /* @__PURE__ */ te(function(e, t) {
242
- var s = {};
243
- for (var r in t)
244
- e(t[r], r, t) && (s[r] = t[r]);
245
- return s;
246
- });
247
- const v = (n) => typeof n == "function" && !!(n.constructor && n.call && n.apply), P = (n) => typeof n == "string", j = (n) => n === null, w = (n) => typeof n > "u", K = (n) => j(n) || w(n), gr = (n) => typeof n == "bigint", O = (n) => !w(n), ye = (n) => !K(n), hr = (n) => ye(n) && n !== "", $t = (n) => {
248
- switch (Object.prototype.toString.call(n)) {
249
- case "[object Error]":
250
- case "[object Exception]":
251
- case "[object DOMException]":
252
- return !0;
253
- default:
254
- return n instanceof Error;
255
- }
256
- }, yt = (n, e) => {
257
- const t = e.split(".");
258
- return fr(t, n);
259
- }, pr = (n, e) => !!yt(n, e), mr = (n) => typeof n == "object", vr = (n) => !j(n) && mr(n) && !Array.isArray(n), k = (n) => !j(n) && Object.prototype.toString.call(n) === "[object Object]", Er = (n, e) => {
260
- if (!Array.isArray(n) || !Array.isArray(e))
261
- return S(e);
262
- const t = S(n);
263
- return e.forEach((s, r) => {
264
- t[r] = Array.isArray(s) || vr(s) ? (
265
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
266
- L(t[r], s)
267
- ) : s;
268
- }), t;
269
- }, L = (n, e) => dr(Er, n, e), ie = (n) => k(n) && Object.keys(n).length > 0, Ae = (n) => {
270
- const e = Nn(O, n);
271
- return Object.keys(e).forEach((t) => {
272
- const s = e[t];
273
- k(s) && (e[t] = Ae(s));
274
- }), e;
275
- }, tt = (n) => {
276
- const e = Nn(ye, n);
277
- return Object.keys(e).forEach((t) => {
278
- const s = e[t];
279
- k(s) && (e[t] = tt(s));
280
- }), e;
281
- }, ee = (n) => {
282
- if (ie(n))
283
- return tt(n);
284
- }, q = (n, e) => O(e) ? O(n) ? n === !0 : e : n === !0, yr = (n) => n.replace(/^\s+|\s+$/gm, ""), Kt = (n) => n.replace(/^\.+/, ""), nt = (n) => {
285
- let e = n;
286
- if (!P(n) && !K(n))
287
- try {
288
- e = JSON.stringify(n);
289
- } catch {
290
- e = null;
291
- }
292
- return e;
293
- }, br = (n) => {
294
- const e = Array.from(n, (t) => String.fromCodePoint(t)).join("");
295
- return globalThis.btoa(e);
296
- }, Sr = (n) => br(new TextEncoder().encode(n)), st = (n, e, t, s, r) => {
297
- const i = { category: n, name: e, properties: t, options: s, callback: void 0 };
298
- v(r) && (i.callback = r), v(s) && (i.category = n, i.name = e, i.properties = t, i.options = void 0, i.callback = s), v(t) && (i.category = n, i.name = e, i.properties = void 0, i.options = void 0, i.callback = t), v(e) && (i.category = n, i.name = void 0, i.properties = void 0, i.options = void 0, i.callback = e), v(n) && (i.category = void 0, i.name = void 0, i.properties = void 0, i.options = void 0, i.callback = n), k(n) ? (i.name = void 0, i.category = void 0, i.properties = n, v(e) ? i.options = void 0 : i.options = e) : k(e) && (i.name = void 0, i.properties = e, v(t) ? i.options = void 0 : i.options = t), P(n) && !P(e) && (i.category = void 0, i.name = n), O(i.category) || (i.category = void 0), O(i.name) || (i.name = void 0), i.properties = i.properties ? S(i.properties) : {}, O(i.options) ? i.options = S(i.options) : i.options = void 0;
299
- const a = P(i.name) ? i.name : i.properties.name, l = P(i.category) ? i.category : i.properties.category;
300
- return i.properties = L(k(i.properties) ? i.properties : {}, { ...a && { name: a }, ...l && { category: l } }), i;
301
- }, Mt = (n, e, t, s) => {
302
- const r = { name: n, properties: e, options: t, callback: void 0 };
303
- return v(s) && (r.callback = s), v(t) && (r.properties = e, r.options = void 0, r.callback = t), v(e) && (r.properties = void 0, r.options = void 0, r.callback = e), r.properties = ye(r.properties) ? S(r.properties) : {}, O(r.options) ? r.options = S(r.options) : r.options = void 0, r;
304
- }, Pn = (n, e, t, s) => {
305
- const r = { userId: n, traits: e, options: t, callback: void 0 };
306
- return v(s) && (r.callback = s), v(t) && (r.userId = n, r.traits = e, r.options = void 0, r.callback = t), v(e) && (r.userId = n, r.traits = void 0, r.options = void 0, r.callback = e), (k(n) || j(n)) && (r.userId = null, r.traits = n, v(e) ? r.options = void 0 : r.options = e), r.userId = nt(r.userId), k(r.traits) ? r.traits = S(r.traits) : r.traits = void 0, O(r.options) ? r.options = S(r.options) : r.options = void 0, r;
307
- }, Ln = (n, e, t, s) => {
308
- const r = { to: n, from: e, options: t, callback: void 0 };
309
- return v(s) && (r.callback = s), v(t) && (r.to = n, r.from = e, r.options = void 0, r.callback = t), v(e) ? (r.to = n, r.from = void 0, r.options = void 0, r.callback = e) : (k(e) || j(e)) && (r.to = n, r.from = void 0, r.options = e), O(r.to) && (r.to = nt(r.to)), O(r.from) ? r.from = nt(r.from) : r.from = void 0, O(r.options) ? r.options = S(r.options) : r.options = void 0, r;
310
- }, wn = (n, e, t, s) => {
311
- const r = { groupId: n, traits: e, options: t, callback: void 0 };
312
- return v(s) && (r.callback = s), v(t) && (r.groupId = n, r.traits = e, r.options = void 0, r.callback = t), v(e) && (r.groupId = n, r.traits = void 0, r.options = void 0, r.callback = e), (k(n) || j(n)) && (r.groupId = null, r.traits = n, v(e) ? r.options = void 0 : r.options = e), r.groupId = nt(r.groupId), k(r.traits) ? r.traits = S(r.traits) : r.traits = void 0, O(r.options) ? r.options = S(r.options) : r.options = void 0, r;
313
- };
314
- let fe = /* @__PURE__ */ function(n) {
315
- return n.LOADED = "Page Loaded", n.UNLOADED = "Page Unloaded", n;
316
- }({});
317
- const Ut = "API", bt = "CapabilitiesManager", V = "ConfigManager", $n = "EventManager", Ve = "PluginsManager", De = "UserSessionManager", ke = "ErrorHandler", ge = "PluginEngine", _r = "StoreManager", ct = `Ready${Ut}`, Rr = `Load${Ut}`, Ir = "ExternalSrcLoader", Tr = "HttpClient", Or = "RudderStackAnalytics", ut = "AnalyticsCore";
318
- function Ar(n) {
319
- return crypto.getRandomValues(new Uint8Array(n));
320
- }
321
- var qt = 4096, qe = [], se = 0, dt;
322
- for (; se < 256; se++)
323
- qe[se] = (se + 256).toString(16).substring(1);
324
- function Dr() {
325
- (!dt || se + 16 > qt) && (dt = Ar(qt), se = 0);
326
- for (var n = 0, e, t = ""; n < 16; n++)
327
- e = dt[se + n], n == 6 ? t += qe[e & 15 | 64] : n == 8 ? t += qe[e & 63 | 128] : t += qe[e], n & 1 && n > 1 && n < 11 && (t += "-");
328
- return se += 16, t;
329
- }
330
- var ce = 256, Qe = [], je;
331
- for (; ce--; ) Qe[ce] = (ce + 256).toString(16).substring(1);
332
- function kr() {
333
- var n = 0, e, t = "";
334
- if (!je || ce + 16 > 256) {
335
- for (je = Array(n = 256); n--; ) je[n] = 256 * Math.random() | 0;
336
- n = ce = 0;
337
- }
338
- for (; n < 16; n++)
339
- e = je[ce + n], n == 6 ? t += Qe[e & 15 | 64] : n == 8 ? t += Qe[e & 63 | 128] : t += Qe[e], n & 1 && n > 1 && n < 11 && (t += "-");
340
- return ce++, t;
341
- }
342
- const Cr = () => !K(globalThis.crypto) && v(globalThis.crypto.getRandomValues), ot = () => Cr() ? Dr() : kr(), Nr = (n) => {
343
- let e = !1, t = !1;
344
- function s() {
345
- e || (e = !0, n(t), setTimeout(() => {
346
- e = !1;
347
- }, 0));
348
- }
349
- globalThis.addEventListener("beforeunload", () => {
350
- t = !1, s();
351
- }), globalThis.addEventListener("blur", () => {
352
- t = !0, s();
353
- }), globalThis.addEventListener("focus", () => {
354
- e = !1;
355
- }), document.addEventListener("pagehide", () => {
356
- t = document.visibilityState === "hidden", s();
357
- }), document.addEventListener("visibilitychange", () => {
358
- t = !0, document.visibilityState === "hidden" ? s() : e = !1;
359
- });
360
- }, St = (n) => n.toISOString(), Pr = () => St(/* @__PURE__ */ new Date()), b = ":: ", Lr = (n) => `A script with the id "${n}" is already loaded. Skipping the loading of this script to prevent conflicts.`, Qt = (n, e) => `Failed to load the script with the id "${n}" from URL "${e}".`, wr = (n, e, t) => `A timeout of ${t} ms occurred while trying to load the script with id "${n}" from URL "${e}".`, $r = (n, e) => `${n}${b}A circular reference has been detected in the object and the property "${e}" has been dropped from the output.`, Mr = "Failed to convert the value to a JSON string.", Ur = "Failed to encode the cookie data.", Br = "JSONStringify", xr = "[BigInt]", Mn = "[Circular Reference]", Fr = (n, e, t) => {
361
- const s = [];
362
- return function(r, i) {
363
- if (!(e != null && e.includes(r)) && !(n && K(i))) {
364
- if (typeof i != "object" || j(i))
365
- return i;
366
- for (; s.length > 0 && s[s.length - 1] !== this; )
367
- s.pop();
368
- return s.includes(i) ? (t == null || t.warn($r(Br, r)), Mn) : (s.push(i), i);
369
- }
370
- };
371
- }, W = (n, e, t, s) => {
372
- try {
373
- return JSON.stringify(n, Fr(e, t, s));
374
- } catch (r) {
375
- return s == null || s.warn(Mr, r), null;
376
- }
377
- }, Hr = (n) => {
378
- const e = [];
379
- return function(s, r) {
380
- if (gr(r))
381
- return xr;
382
- for (; e.length > 0 && e[e.length - 1] !== this; )
383
- e.pop();
384
- return e.includes(r) ? Mn : (e.push(r), r);
385
- };
386
- }, Un = (n, e) => {
387
- const t = Array.isArray(n) ? [] : {};
388
- for (const s in n)
389
- if (Object.hasOwnProperty.call(n, s)) {
390
- const r = n[s], i = e.call(n, s, r);
391
- k(i) || Array.isArray(i) ? t[s] = Un(i, e) : t[s] = i;
392
- }
393
- return t;
394
- }, _ = (n, e) => {
395
- const t = Hr(), s = t.call(n, "", n);
396
- return k(n) || Array.isArray(n) ? Un(n, t) : s;
397
- }, We = "[SDK DISPATCHED ERROR]", Bt = (n) => {
398
- const { stack: e, stacktrace: t } = n, s = n["opera#sourceloc"], r = e ?? t ?? s;
399
- if (r && typeof r == "string")
400
- return r;
401
- }, Be = (n, e) => {
402
- let t = n;
403
- return $t(n) ? t.message = `${e}: ${n.message}` : t = new Error(`${e}: ${W(n)}`), t;
404
- }, N = (n) => {
405
- if ($t(n)) {
406
- const e = Bt(n);
407
- if (e) {
408
- const { stack: t, stacktrace: s } = n, r = n["opera#sourceloc"];
409
- switch (e) {
410
- case t:
411
- n.stack = `${t}
412
- ${We}`;
413
- break;
414
- case s:
415
- n.stacktrace = `${s}
416
- ${We}`;
417
- break;
418
- case r:
419
- default:
420
- n["opera#sourceloc"] = `${r}
421
- ${We}`;
422
- break;
423
- }
424
- }
425
- }
426
- globalThis.dispatchEvent(new ErrorEvent("error", { error: n, bubbles: !0, cancelable: !0, composed: !0 }));
427
- }, Wt = "RudderLabs JavaScript SDK", we = "3.14.0", Gr = "com.rudderlabs.javascript", Bn = "npm", Xt = "RudderJS-Initiated", Vr = "ad-block page request", jr = "/ad-blocked", Pe = "preloadedEventsBuffer", Kr = "Consent Management Interaction", qr = "ajs_trait_", Qr = "ajs_prop_", zt = "ajs_aid", Yt = "ajs_uid", Jt = "ajs_event", Wr = 10 * 1e3, Xr = 31536e3 * 1e3, $e = 30 * 60 * 1e3, Zt = 10 * 1e3, zr = 10 * 1e3, Yr = 250, xn = (n = "app") => {
428
- globalThis.RudderStackGlobals || (globalThis.RudderStackGlobals = {}), globalThis.RudderStackGlobals[n] || (globalThis.RudderStackGlobals[n] = {});
429
- }, Me = (n, e, t = "app") => {
430
- xn(t), globalThis.RudderStackGlobals[t][n] = e;
431
- }, Fn = (n, e = "app") => (xn(e), globalThis.RudderStackGlobals[e][n]);
432
- function Jr(n, e, t = Yr) {
433
- let s;
434
- return (...r) => {
435
- globalThis.clearTimeout(s), s = globalThis.setTimeout(() => {
436
- n.apply(e, r);
437
- }, t);
438
- };
439
- }
440
- const en = (n, e) => {
441
- const t = {};
442
- return n.forEach((s, r) => {
443
- if (r.startsWith(e)) {
444
- const i = r.substring(e.length);
445
- t[i] = n.get(r);
446
- }
447
- }), t;
448
- }, Zr = (n = []) => {
449
- const e = { trait: qr, properties: Qr }, t = new URLSearchParams(globalThis.location.search);
450
- t.get(Jt) && n.unshift(["track", t.get(Jt), en(t, e.properties)]), t.get(Yt) && n.unshift(["identify", t.get(Yt), en(t, e.trait)]), t.get(zt) && n.unshift(["setAnonymousId", t.get(zt)]);
451
- }, ei = (n) => {
452
- const e = "load";
453
- let t = [], s = 0;
454
- for (; s < n.length; ) {
455
- if (n[s] && n[s][0] === e) {
456
- t = S(n[s]), n.splice(s, 1);
457
- break;
458
- }
459
- s += 1;
460
- }
461
- return t;
462
- }, ti = (n) => {
463
- const e = "consent", t = n.filter((r) => r[0] === e), s = n.filter((r) => r[0] !== e);
464
- n.splice(0, n.length, ...t, ...s);
465
- }, ni = (n) => {
466
- const e = Fn(Pe) || [];
467
- Zr(e), e.length > 0 && (n.enqueuePreloadBufferEvents(e), Me(Pe, []));
468
- }, si = (n, e) => {
469
- const t = n.shift();
470
- let s;
471
- if (v(e[t])) {
472
- switch (t) {
473
- case "page":
474
- s = st(...n);
475
- break;
476
- case "track":
477
- s = Mt(...n);
478
- break;
479
- case "identify":
480
- s = Pn(...n);
481
- break;
482
- case "alias":
483
- s = Ln(...n);
484
- break;
485
- case "group":
486
- s = wn(...n);
487
- break;
488
- default:
489
- e[t](...n);
490
- break;
491
- }
492
- s && e[t](s);
493
- }
494
- }, ri = 10 * 1e3, ii = "RS_JS_SDK", oi = (n, e, t = !0, s = null, r = null, i = {}) => {
495
- const a = document.createElement("script");
496
- return a.type = "text/javascript", a.onload = s, a.onerror = r, a.src = n, a.id = e, a.async = t, Object.keys(i).forEach((l) => {
497
- a.setAttribute(l, i[l]);
498
- }), a.setAttribute("data-loader", ii), a;
499
- }, ai = (n) => {
500
- var i, a, l, c;
501
- const e = document.getElementsByTagName("head");
502
- if (e.length > 0) {
503
- (a = e[0]) == null || a.insertBefore(n, (i = e[0]) == null ? void 0 : i.firstChild);
504
- return;
505
- }
506
- const t = document.getElementsByTagName("script");
507
- if (t.length > 0 && ((l = t[0]) != null && l.parentNode)) {
508
- (c = t[0]) == null || c.parentNode.insertBefore(n, t[0]);
509
- return;
510
- }
511
- const s = document.createElement("head");
512
- s.appendChild(n);
513
- const r = document.getElementsByTagName("html")[0];
514
- r == null || r.insertBefore(s, r.firstChild);
515
- }, li = (n, e, t, s = !0, r) => new Promise((i, a) => {
516
- document.getElementById(e) && a(new Error(Lr(e)));
517
- try {
518
- let c;
519
- ai(oi(n, e, s, () => {
520
- globalThis.clearTimeout(c), i(e);
521
- }, () => {
522
- globalThis.clearTimeout(c), a(new Error(Qt(e, n)));
523
- }, r)), c = globalThis.setTimeout(() => {
524
- a(new Error(wr(e, n, t)));
525
- }, t);
526
- } catch (c) {
527
- a(Be(c, Qt(e, n)));
528
- }
529
- });
530
- class Hn {
531
- constructor(e, t, s = ri) {
532
- this.errorHandler = e, this.logger = t, this.timeout = s, this.onError = this.onError.bind(this);
533
- }
534
- /**
535
- * Load external resource of type javascript
536
- */
537
- loadJSFile(e) {
538
- const { url: t, id: s, timeout: r, async: i, callback: a, extraAttributes: l } = e, c = !v(a);
539
- li(t, s, r || this.timeout, i, l).then((d) => {
540
- c || a(d);
541
- }).catch((d) => {
542
- this.onError(d), c || a();
543
- });
544
- }
545
- /**
546
- * Handle errors
547
- */
548
- onError(e) {
549
- this.errorHandler.onError(e, Ir);
550
- }
551
- }
552
- var ci = Symbol.for("preact-signals");
553
- function at() {
554
- if (re > 1)
555
- re--;
556
- else {
557
- for (var n, e = !1; Le !== void 0; ) {
558
- var t = Le;
559
- for (Le = void 0, _t++; t !== void 0; ) {
560
- var s = t.o;
561
- if (t.o = void 0, t.f &= -3, !(8 & t.f) && Vn(t)) try {
562
- t.c();
563
- } catch (r) {
564
- e || (n = r, e = !0);
565
- }
566
- t = s;
567
- }
568
- }
569
- if (_t = 0, re--, e) throw n;
570
- }
571
- }
572
- function $(n) {
573
- if (re > 0) return n();
574
- re++;
575
- try {
576
- return n();
577
- } finally {
578
- at();
579
- }
580
- }
581
- var I = void 0, Le = void 0, re = 0, _t = 0, rt = 0;
582
- function Gn(n) {
583
- if (I !== void 0) {
584
- var e = n.n;
585
- if (e === void 0 || e.t !== I)
586
- return e = { i: 0, S: n, p: I.s, n: void 0, t: I, e: void 0, x: void 0, r: e }, I.s !== void 0 && (I.s.n = e), I.s = e, n.n = e, 32 & I.f && n.S(e), e;
587
- if (e.i === -1)
588
- return e.i = 0, e.n !== void 0 && (e.n.p = e.p, e.p !== void 0 && (e.p.n = e.n), e.p = I.s, e.n = void 0, I.s.n = e, I.s = e), e;
589
- }
590
- }
591
- function M(n) {
592
- this.v = n, this.i = 0, this.n = void 0, this.t = void 0;
593
- }
594
- M.prototype.brand = ci;
595
- M.prototype.h = function() {
596
- return !0;
597
- };
598
- M.prototype.S = function(n) {
599
- this.t !== n && n.e === void 0 && (n.x = this.t, this.t !== void 0 && (this.t.e = n), this.t = n);
600
- };
601
- M.prototype.U = function(n) {
602
- if (this.t !== void 0) {
603
- var e = n.e, t = n.x;
604
- e !== void 0 && (e.x = t, n.e = void 0), t !== void 0 && (t.e = e, n.x = void 0), n === this.t && (this.t = t);
605
- }
606
- };
607
- M.prototype.subscribe = function(n) {
608
- var e = this;
609
- return J(function() {
610
- var t = e.value, s = I;
611
- I = void 0;
612
- try {
613
- n(t);
614
- } finally {
615
- I = s;
616
- }
617
- });
618
- };
619
- M.prototype.valueOf = function() {
620
- return this.value;
621
- };
622
- M.prototype.toString = function() {
623
- return this.value + "";
624
- };
625
- M.prototype.toJSON = function() {
626
- return this.value;
627
- };
628
- M.prototype.peek = function() {
629
- var n = I;
630
- I = void 0;
631
- try {
632
- return this.value;
633
- } finally {
634
- I = n;
635
- }
636
- };
637
- Object.defineProperty(M.prototype, "value", { get: function() {
638
- var n = Gn(this);
639
- return n !== void 0 && (n.i = this.i), this.v;
640
- }, set: function(n) {
641
- if (n !== this.v) {
642
- if (_t > 100) throw new Error("Cycle detected");
643
- this.v = n, this.i++, rt++, re++;
644
- try {
645
- for (var e = this.t; e !== void 0; e = e.x) e.t.N();
646
- } finally {
647
- at();
648
- }
649
- }
650
- } });
651
- function f(n) {
652
- return new M(n);
653
- }
654
- function Vn(n) {
655
- for (var e = n.s; e !== void 0; e = e.n) if (e.S.i !== e.i || !e.S.h() || e.S.i !== e.i) return !0;
656
- return !1;
657
- }
658
- function jn(n) {
659
- for (var e = n.s; e !== void 0; e = e.n) {
660
- var t = e.S.n;
661
- if (t !== void 0 && (e.r = t), e.S.n = e, e.i = -1, e.n === void 0) {
662
- n.s = e;
663
- break;
664
- }
665
- }
666
- }
667
- function Kn(n) {
668
- for (var e = n.s, t = void 0; e !== void 0; ) {
669
- var s = e.p;
670
- e.i === -1 ? (e.S.U(e), s !== void 0 && (s.n = e.n), e.n !== void 0 && (e.n.p = s)) : t = e, e.S.n = e.r, e.r !== void 0 && (e.r = void 0), e = s;
671
- }
672
- n.s = t;
673
- }
674
- function xe(n) {
675
- M.call(this, void 0), this.x = n, this.s = void 0, this.g = rt - 1, this.f = 4;
676
- }
677
- (xe.prototype = new M()).h = function() {
678
- if (this.f &= -3, 1 & this.f) return !1;
679
- if ((36 & this.f) == 32 || (this.f &= -5, this.g === rt)) return !0;
680
- if (this.g = rt, this.f |= 1, this.i > 0 && !Vn(this))
681
- return this.f &= -2, !0;
682
- var n = I;
683
- try {
684
- jn(this), I = this;
685
- var e = this.x();
686
- (16 & this.f || this.v !== e || this.i === 0) && (this.v = e, this.f &= -17, this.i++);
687
- } catch (t) {
688
- this.v = t, this.f |= 16, this.i++;
689
- }
690
- return I = n, Kn(this), this.f &= -2, !0;
691
- };
692
- xe.prototype.S = function(n) {
693
- if (this.t === void 0) {
694
- this.f |= 36;
695
- for (var e = this.s; e !== void 0; e = e.n) e.S.S(e);
696
- }
697
- M.prototype.S.call(this, n);
698
- };
699
- xe.prototype.U = function(n) {
700
- if (this.t !== void 0 && (M.prototype.U.call(this, n), this.t === void 0)) {
701
- this.f &= -33;
702
- for (var e = this.s; e !== void 0; e = e.n) e.S.U(e);
703
- }
704
- };
705
- xe.prototype.N = function() {
706
- if (!(2 & this.f)) {
707
- this.f |= 6;
708
- for (var n = this.t; n !== void 0; n = n.x) n.t.N();
709
- }
710
- };
711
- Object.defineProperty(xe.prototype, "value", { get: function() {
712
- if (1 & this.f) throw new Error("Cycle detected");
713
- var n = Gn(this);
714
- if (this.h(), n !== void 0 && (n.i = this.i), 16 & this.f) throw this.v;
715
- return this.v;
716
- } });
717
- function qn(n) {
718
- var e = n.u;
719
- if (n.u = void 0, typeof e == "function") {
720
- re++;
721
- var t = I;
722
- I = void 0;
723
- try {
724
- e();
725
- } catch (s) {
726
- throw n.f &= -2, n.f |= 8, xt(n), s;
727
- } finally {
728
- I = t, at();
729
- }
730
- }
731
- }
732
- function xt(n) {
733
- for (var e = n.s; e !== void 0; e = e.n) e.S.U(e);
734
- n.x = void 0, n.s = void 0, qn(n);
735
- }
736
- function ui(n) {
737
- if (I !== this) throw new Error("Out-of-order effect");
738
- Kn(this), I = n, this.f &= -2, 8 & this.f && xt(this), at();
739
- }
740
- function Fe(n) {
741
- this.x = n, this.u = void 0, this.s = void 0, this.o = void 0, this.f = 32;
742
- }
743
- Fe.prototype.c = function() {
744
- var n = this.S();
745
- try {
746
- if (8 & this.f || this.x === void 0) return;
747
- var e = this.x();
748
- typeof e == "function" && (this.u = e);
749
- } finally {
750
- n();
751
- }
752
- };
753
- Fe.prototype.S = function() {
754
- if (1 & this.f) throw new Error("Cycle detected");
755
- this.f |= 1, this.f &= -9, qn(this), jn(this), re++;
756
- var n = I;
757
- return I = this, ui.bind(this, n);
758
- };
759
- Fe.prototype.N = function() {
760
- 2 & this.f || (this.f |= 2, this.o = Le, Le = this);
761
- };
762
- Fe.prototype.d = function() {
763
- this.f |= 8, 1 & this.f || xt(this);
764
- };
765
- function J(n) {
766
- var e = new Fe(n);
767
- try {
768
- e.c();
769
- } catch (t) {
770
- throw e.d(), t;
771
- }
772
- return e.d.bind(e);
773
- }
774
- class di {
775
- constructor() {
776
- this.items = [];
777
- }
778
- enqueue(e) {
779
- this.items.push(e);
780
- }
781
- dequeue() {
782
- return this.items.length === 0 ? null : this.items.shift();
783
- }
784
- isEmpty() {
785
- return this.items.length === 0;
786
- }
787
- size() {
788
- return this.items.length;
789
- }
790
- clear() {
791
- this.items = [];
792
- }
793
- }
794
- const Ke = { LOG: 0, INFO: 1, DEBUG: 2, WARN: 3, ERROR: 4, NONE: 5 }, tn = "LOG", Qn = "ERROR", fi = "RS SDK", gi = "font-weight: bold; background: black; color: white;", hi = "font-weight: normal;";
795
- class pi {
796
- constructor(e = tn, t = "", s = console) {
797
- this.minLogLevel = Ke[e], this.scope = t, this.logProvider = s;
798
- }
799
- log(...e) {
800
- this.outputLog("LOG", e);
801
- }
802
- info(...e) {
803
- this.outputLog("INFO", e);
804
- }
805
- debug(...e) {
806
- this.outputLog("DEBUG", e);
807
- }
808
- warn(...e) {
809
- this.outputLog("WARN", e);
810
- }
811
- error(...e) {
812
- this.outputLog("ERROR", e);
813
- }
814
- outputLog(e, t) {
815
- var s, r;
816
- this.minLogLevel <= Ke[e] && ((r = (s = this.logProvider)[e.toLowerCase()]) == null || r.call(s, ...this.formatLogData(t)));
817
- }
818
- setScope(e) {
819
- this.scope = e || this.scope;
820
- }
821
- // TODO: should we allow to change the level via global variable on run time
822
- // to assist on the fly debugging?
823
- setMinLogLevel(e) {
824
- this.minLogLevel = Ke[e], w(this.minLogLevel) && (this.minLogLevel = Ke[tn]);
825
- }
826
- /**
827
- * Formats the console message using `scope` and styles
828
- */
829
- formatLogData(e) {
830
- if (Array.isArray(e) && e.length > 0) {
831
- let t = `%c ${fi}`;
832
- this.scope && (t = `${t} - ${this.scope}`);
833
- const s = P(e[0]) ? e[0].trim() : "";
834
- t = `${t} %c ${s}`;
835
- const r = [
836
- t,
837
- gi,
838
- // add style for the prefix
839
- hi
840
- // reset the style for the actual message
841
- ];
842
- return P(e[0]) || r.push(e[0]), r.push(...e.slice(1)), r;
843
- }
844
- return e;
845
- }
846
- }
847
- const X = new pi();
848
- let z = /* @__PURE__ */ function(n) {
849
- return n.HANDLEDEXCEPTION = "handledException", n.UNHANDLEDEXCEPTION = "unhandledException", n.UNHANDLEDREJECTION = "unhandledPromiseRejection", n;
850
- }({});
851
- const Wn = ["localStorage", "memoryStorage", "cookieStorage", "sessionStorage", "none"], Rt = "cookieStorage", nn = "Unable to process/parse source configuration response", mi = "The source is disabled. Please enable the source in the dashboard to send events.", vi = "Failed to prepare data for the request.", Ei = "Failed to invoke plugin because the extension point name is missing.", yi = "Failed to invoke plugin because the extension point name is invalid.", bi = (n) => `${n}${b}The "getSourceConfig" load API option must be a function that returns valid source configuration data.`, Si = (n, e, t) => `${n}${b}The base URL "${t}" for ${e} is not valid.`, _i = (n, e, t) => `${n}${b}The consent manager "${e}" is not supported. Please choose one of the following supported consent managers: "${Object.keys(t)}".`, Ri = (n, e) => `${n}${b}Ignoring a non-error: ${e}.`, Ii = (n) => `${n}${b}Failed to log breadcrumb.`, Ti = (n) => `${n}${b}Failed to handle the error.`, Oi = (n) => `${n}${b}Plugin name is missing.`, Ai = (n, e) => `${n}${b}Plugin "${e}" already exists.`, Di = (n, e) => `${n}${b}Plugin "${e}" not found.`, ki = (n, e) => `${n}${b}Plugin "${e}" not found in plugins but found in byName. This indicates a bug in the plugin engine. Please report this issue to the development team.`, Ci = (n, e, t) => `${n}${b}Plugin "${e}" could not be loaded because some of its dependencies "${t}" do not exist.`, Ni = (n, e, t) => `${n}${b}Failed to invoke the "${e}" extension point of plugin "${t}".`, Pi = (n, e) => `${n}${b}The "${e}" storage type is `, sn = "Failed to fetch the source config", Li = (n, e) => `${n}${b}The write key "${e}" is invalid. It must be a non-empty string. Please check that the write key is correct and try again.`, wi = (n, e) => `${n}${b}The data plane URL "${e}" is invalid. It must be a valid URL string. Please check that the data plane URL is correct and try again.`, Xn = (n) => `${n}${b}The provided callback parameter is not a function.`, $i = (n, e, t, s) => `${n} with status: ${e}, ${t} for URL: ${s}.`, Mi = (n, e, t) => `${n} due to timeout or no connection (${e ? e.type : ""}) for URL: ${t}.`, Ui = (n, e) => `${n} for URL: ${e}`, Bi = (n) => `Failed to save the value for "${n}" to storage`, xi = (n) => `Failed to retrieve or parse data for "${n}" from storage`, Fi = (n) => `The server responded with status ${n} while setting the cookies. As a fallback, the cookies will be set client side.`, Hi = (n) => `The server failed to set the ${n} cookie. As a fallback, the cookies will be set client side.`, Gi = "Failed to set/remove cookies via server. As a fallback, the cookies will be managed client side.", Vi = (n, e, t) => `${n}${b}The storage type "${e}" is not supported. Please choose one of the following supported types: "${Wn}". The default type "${t}" will be used instead.`, ji = (n, e, t, s) => `${n}${b}The storage encryption version "${e}" is not supported. Please choose one of the following supported versions: "${Object.keys(t)}". The default version "${s}" will be used instead.`, Ki = (n, e, t) => `${n}${b}The storage data migration has been disabled because the configured storage encryption version (${e}) is not the latest (${t}). To enable storage data migration, please update the storage encryption version to the latest version.`, qi = (n, e, t) => `${n}${b}The provided cookie domain (${e}) does not match the current webpage's domain (${t}). Hence, the cookies will be set client-side.`, Qi = (n, e, t, s) => `${n}${b}The "${e}" property defined under "${t}" is a reserved keyword. Please choose a different property name to avoid conflicts with reserved keywords (${s}).`, Wi = (n) => `${n}${b}Please make sure that the "context" property in the event API's "options" argument is a valid object literal with key-value pairs.`, Xi = (n) => `${n}${b}The Beacon API is not supported by your browser. The events will be sent using XHR instead.`, zi = (n, e, t) => `${n}${b}The session timeout value "${e}" is not a number. The default timeout of ${t} ms will be used instead.`, Yi = (n) => `${n}${b}The session timeout value is 0, which disables the automatic session tracking feature. If you want to enable session tracking, please provide a positive integer value for the timeout.`, Ji = (n, e, t) => `${n}${b}The session timeout value ${e} ms is less than the recommended minimum of ${t} ms. Please consider increasing the timeout value to ensure optimal performance and reliability.`, Zi = (n, e, t) => `${n}${b}The provided session ID (${e}) is either invalid, not a positive integer, or not at least "${t}" digits long. A new session ID will be auto-generated instead.`, eo = (n) => `${n}${b}The storage is either full or unavailable, so the data will not be persisted. Switching to in-memory storage.`, to = (n, e, t, s) => `${n}${b}The storage type "${t}" is not available for entry "${e}". The SDK will initialize the entry with "${s}" storage type instead.`, no = (n) => `${n}${b}The callback threw an exception`, so = (n, e) => `${n}${b}The provided source config URL "${e}" is invalid. Using the default source config URL instead.`, ro = (n, e) => `Failed to load the polyfill script with ID "${n}" from URL ${e}.`, io = (n, e, t) => `${n}${b}The pre-consent storage strategy "${e}" is not supported. Please choose one of the following supported strategies: "none, session, anonymousId". The default strategy "${t}" will be used instead.`, oo = (n, e, t) => `${n}${b}The pre-consent events delivery type "${e}" is not supported. Please choose one of the following supported types: "immediate, buffer". The default type "${t}" will be used instead.`, ao = (n, e) => `${n}${b}${e} plugin is deprecated. Please exclude it from the load API options.`, lo = (n, e, t, s) => {
852
- const r = t.length === 1, i = r ? ` '${t[0]}' plugin was` : ` ['${t.join("', '")}'] plugins were`, a = `${n}${b}${e}, but${i} not configured to load.`;
853
- return s ? `${a} So, ${r ? "the plugin" : "those plugins"} will be loaded automatically.` : `${a} Ignore if this was intentional. Otherwise, consider adding ${r ? "it" : "them"} to the 'plugins' load API option.`;
854
- }, co = (n, e) => `${n}${b}The provided polyfill URL "${e}" is invalid. The default polyfill URL will be used instead.`, uo = (n) => `The cookie data for ${n} seems to be encrypted using SDK versions < v3. The data is dropped. This can potentially stem from using SDK versions < v3 on other sites or web pages that can share cookies with this webpage. We recommend using the same SDK (v3) version everywhere or avoid disabling the storage data migration.`, fo = (n) => `${n}${b}Page Unloaded event can only be tracked when the Beacon transport is active. Please enable "useBeacon" load API option.`, go = (n, e) => `${n}${b}Ignoring unknown plugins: ${e.join(", ")}.`, zn = { All: !0 }, Ft = "js-integrations", Yn = "plugins", ho = new RegExp("^(https?:\\/\\/)(((([a-zA-Z\\d]([a-zA-Z\\d-]*[a-zA-Z\\d])*)\\.)+[a-zA-Z]{2,}|localhost|((25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9]?)))(\\:\\d+)?(\\/[-a-zA-Z\\d%_.~+]*)*(\\?[;&a-zA-Z\\d%_.~+=-]*)?(\\#[-a-zA-Z\\d_]*)?$"), Ue = "modern", Jn = "https://cdn.rudderlabs.com", Ht = "v3", Zn = `${Jn}/${Ht}/${Ue}/${Ft}`, es = `${Jn}/${Ht}/${Ue}/${Yn}`, ts = "https://api.rudderstack.com", ae = "v3", po = "xhr", It = { iubenda: "IubendaConsentManager", oneTrust: "OneTrustConsentManager", ketch: "KetchConsentManager", custom: "CustomConsentManager" }, Xe = { [ae]: "StorageEncryption", legacy: "StorageEncryptionLegacy" }, mo = { [po]: "XhrQueue", beacon: "BeaconQueue" }, vo = "rsaRequest", Eo = "rsaMetrics", yo = { configUrl: ts, loadIntegration: !0, sessions: { autoTrack: !0, timeout: $e }, sameSiteCookie: "Lax", polyfillIfRequired: !0, integrations: zn, useBeacon: !1, beaconQueueOptions: {}, destinationsQueueOptions: {}, queueOptions: {}, lockIntegrationsVersion: !0, lockPluginsVersion: !0, uaChTrackLevel: "none", plugins: [], useGlobalIntegrationsConfigInEvents: !1, bufferDataPlaneEventsUntilReady: !1, dataPlaneEventsBufferTimeout: zr, storage: { encryption: { version: ae }, migrate: !0, cookie: {} }, sendAdblockPage: !1, sameDomainCookiesOnly: !1, secureCookie: !1, sendAdblockPageOptions: {}, useServerSideCookies: !1 }, bo = f(S(yo)), R = { userId: "", userTraits: {}, anonymousId: "", groupId: "", groupTraits: {}, initialReferrer: "", initialReferringDomain: "", sessionInfo: {}, authToken: null }, So = 10, _o = { autoTrack: !0, timeout: $e }, Ro = { userId: f(R.userId), userTraits: f(R.userTraits), anonymousId: f(R.anonymousId), groupId: f(R.groupId), groupTraits: f(R.groupTraits), initialReferrer: f(R.initialReferrer), initialReferringDomain: f(R.initialReferringDomain), sessionInfo: f(R.sessionInfo), authToken: f(R.authToken) }, Io = { isOnline: f(!0), storage: { isLocalStorageAvailable: f(!1), isCookieStorageAvailable: f(!1), isSessionStorageAvailable: f(!1) }, isBeaconAvailable: f(!1), isLegacyDOM: f(!1), isUaCHAvailable: f(!1), isCryptoAvailable: f(!1), isIE11: f(!1), isAdBlocked: f(!1) }, To = { isErrorReportingEnabled: f(!1), isMetricsReportingEnabled: f(!1), breadcrumbs: f([]) }, Oo = f(void 0), Ao = { activeDataplaneUrl: f(void 0), integrationsCDNPath: f(Zn), pluginsCDNPath: f(es), sourceConfigUrl: f(void 0), status: f(void 0), initialized: f(!1), logLevel: f(Qn), loaded: f(!1), readyCallbacks: f([]), writeKey: f(void 0), dataPlaneUrl: f(void 0) }, Do = { enabled: f(!1), initialized: f(!1), data: f({}), activeConsentManagerPluginName: f(void 0), preConsent: f({ enabled: !1 }), postConsent: f({}), resolutionStrategy: f("and"), provider: f(void 0), metadata: f(void 0) }, ko = { retries: f(0), dropped: f(0), sent: f(0), queued: f(0), triggered: f(0), metricsServiceUrl: f(void 0) }, Co = { app: f({ name: Wt, namespace: Gr, version: we, installType: Bn }), traits: f(null), library: f({ name: Wt, version: we, snippetVersion: globalThis.RudderSnippetVersion }), userAgent: f(null), device: f(null), network: f(null), os: f({ name: "", version: "" }), locale: f(null), screen: f({ density: 0, width: 0, height: 0, innerWidth: 0, innerHeight: 0 }), "ua-ch": f(void 0), timezone: f(void 0) }, No = { configuredDestinations: f([]), activeDestinations: f([]), loadOnlyIntegrations: f({}), failedDestinations: f([]), loadIntegration: f(!0), initializedDestinations: f([]), clientDestinationsReady: f(!1), integrationsConfig: f({}) }, Po = { toBeProcessedArray: f([]), readyCallbacksArray: f([]) }, Lo = { ready: f(!1), loadedPlugins: f([]), failedPlugins: f([]), pluginsToLoadFromConfig: f([]), activePlugins: f([]), totalPluginsToLoad: f(0) }, wo = { encryptionPluginName: f(void 0), migrate: f(!1), type: f(void 0), cookie: f(void 0), entries: f({}), trulyAnonymousTracking: f(!1) }, $o = { isEnabledServerSideCookies: f(!1), dataServiceUrl: f(void 0) }, Mo = {
855
- eventsQueuePluginName: f(void 0),
856
- deliveryEnabled: f(!0)
857
- // Delivery should always happen
858
- }, Uo = { enabled: f(!1), pageLifecycle: { enabled: f(!1), visitId: f(void 0), pageLoadedTimestamp: f(void 0) } }, Bo = { capabilities: Io, consents: Do, context: Co, eventBuffer: Po, lifecycle: Ao, loadOptions: bo, metrics: ko, nativeDestinations: No, plugins: Lo, reporting: To, session: Ro, source: Oo, storage: wo, serverCookies: $o, dataPlaneEvents: Mo, autoTrack: Uo }, o = { ...S(Bo) };
859
- function ns(n) {
860
- return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
861
- }
862
- var ze = { exports: {} }, Ye = { exports: {} }, xo = Ye.exports, rn;
863
- function Fo() {
864
- return rn || (rn = 1, function(n, e) {
865
- (function(t, s) {
866
- n.exports = s();
867
- })(xo, function() {
868
- function t(p) {
869
- return !isNaN(parseFloat(p)) && isFinite(p);
870
- }
871
- function s(p) {
872
- return p.charAt(0).toUpperCase() + p.substring(1);
873
- }
874
- function r(p) {
875
- return function() {
876
- return this[p];
877
- };
878
- }
879
- var i = ["isConstructor", "isEval", "isNative", "isToplevel"], a = ["columnNumber", "lineNumber"], l = ["fileName", "functionName", "source"], c = ["args"], d = ["evalOrigin"], u = i.concat(a, l, c, d);
880
- function m(p) {
881
- if (p)
882
- for (var E = 0; E < u.length; E++)
883
- p[u[E]] !== void 0 && this["set" + s(u[E])](p[u[E]]);
884
- }
885
- m.prototype = { getArgs: function() {
886
- return this.args;
887
- }, setArgs: function(p) {
888
- if (Object.prototype.toString.call(p) !== "[object Array]")
889
- throw new TypeError("Args must be an Array");
890
- this.args = p;
891
- }, getEvalOrigin: function() {
892
- return this.evalOrigin;
893
- }, setEvalOrigin: function(p) {
894
- if (p instanceof m)
895
- this.evalOrigin = p;
896
- else if (p instanceof Object)
897
- this.evalOrigin = new m(p);
898
- else
899
- throw new TypeError("Eval Origin must be an Object or StackFrame");
900
- }, toString: function() {
901
- var p = this.getFileName() || "", E = this.getLineNumber() || "", T = this.getColumnNumber() || "", C = this.getFunctionName() || "";
902
- return this.getIsEval() ? p ? "[eval] (" + p + ":" + E + ":" + T + ")" : "[eval]:" + E + ":" + T : C ? C + " (" + p + ":" + E + ":" + T + ")" : p + ":" + E + ":" + T;
903
- } }, m.fromString = function(E) {
904
- var T = E.indexOf("("), C = E.lastIndexOf(")"), _e = E.substring(0, T), lt = E.substring(T + 1, C).split(","), He = E.substring(C + 1);
905
- if (He.indexOf("@") === 0)
906
- var Re = /@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(He, ""), Ts = Re[1], Os = Re[2], As = Re[3];
907
- return new m({ functionName: _e, args: lt || void 0, fileName: Ts, lineNumber: Os || void 0, columnNumber: As || void 0 });
908
- };
909
- for (var y = 0; y < i.length; y++)
910
- m.prototype["get" + s(i[y])] = r(i[y]), m.prototype["set" + s(i[y])] = /* @__PURE__ */ function(p) {
911
- return function(E) {
912
- this[p] = !!E;
913
- };
914
- }(i[y]);
915
- for (var g = 0; g < a.length; g++)
916
- m.prototype["get" + s(a[g])] = r(a[g]), m.prototype["set" + s(a[g])] = /* @__PURE__ */ function(p) {
917
- return function(E) {
918
- if (!t(E))
919
- throw new TypeError(p + " must be a Number");
920
- this[p] = Number(E);
921
- };
922
- }(a[g]);
923
- for (var h = 0; h < l.length; h++)
924
- m.prototype["get" + s(l[h])] = r(l[h]), m.prototype["set" + s(l[h])] = /* @__PURE__ */ function(p) {
925
- return function(E) {
926
- this[p] = String(E);
927
- };
928
- }(l[h]);
929
- return m;
930
- });
931
- }(Ye)), Ye.exports;
932
- }
933
- var Ho = ze.exports, on;
934
- function Go() {
935
- return on || (on = 1, function(n, e) {
936
- (function(t, s) {
937
- n.exports = s(Fo());
938
- })(Ho, function(s) {
939
- var r = /(^|@)\S+:\d+/, i = /^\s*at .*(\S+:\d+|\(native\))/m, a = /^(eval@)?(\[native code])?$/;
940
- return {
941
- /**
942
- * Given an Error object, extract the most information from it.
943
- *
944
- * @param {Error} error object
945
- * @return {Array} of StackFrames
946
- */
947
- parse: function(c) {
948
- if (typeof c.stacktrace < "u" || typeof c["opera#sourceloc"] < "u")
949
- return this.parseOpera(c);
950
- if (c.stack && c.stack.match(i))
951
- return this.parseV8OrIE(c);
952
- if (c.stack)
953
- return this.parseFFOrSafari(c);
954
- throw new Error("Cannot parse given Error object");
955
- },
956
- // Separate line and column numbers from a string of the form: (URI:Line:Column)
957
- extractLocation: function(c) {
958
- if (c.indexOf(":") === -1)
959
- return [c];
960
- var d = /(.+?)(?::(\d+))?(?::(\d+))?$/, u = d.exec(c.replace(/[()]/g, ""));
961
- return [u[1], u[2] || void 0, u[3] || void 0];
962
- },
963
- parseV8OrIE: function(c) {
964
- var d = c.stack.split(`
965
- `).filter(function(u) {
966
- return !!u.match(i);
967
- }, this);
968
- return d.map(function(u) {
969
- u.indexOf("(eval ") > -1 && (u = u.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(,.*$)/g, ""));
970
- var m = u.replace(/^\s+/, "").replace(/\(eval code/g, "(").replace(/^.*?\s+/, ""), y = m.match(/ (\(.+\)$)/);
971
- m = y ? m.replace(y[0], "") : m;
972
- var g = this.extractLocation(y ? y[1] : m), h = y && m || void 0, p = ["eval", "<anonymous>"].indexOf(g[0]) > -1 ? void 0 : g[0];
973
- return new s({ functionName: h, fileName: p, lineNumber: g[1], columnNumber: g[2], source: u });
974
- }, this);
975
- },
976
- parseFFOrSafari: function(c) {
977
- var d = c.stack.split(`
978
- `).filter(function(u) {
979
- return !u.match(a);
980
- }, this);
981
- return d.map(function(u) {
982
- if (u.indexOf(" > eval") > -1 && (u = u.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ":$1")), u.indexOf("@") === -1 && u.indexOf(":") === -1)
983
- return new s({ functionName: u });
984
- var m = /((.*".+"[^@]*)?[^@]*)(?:@)/, y = u.match(m), g = y && y[1] ? y[1] : void 0, h = this.extractLocation(u.replace(m, ""));
985
- return new s({ functionName: g, fileName: h[0], lineNumber: h[1], columnNumber: h[2], source: u });
986
- }, this);
987
- },
988
- parseOpera: function(c) {
989
- return !c.stacktrace || c.message.indexOf(`
990
- `) > -1 && c.message.split(`
991
- `).length > c.stacktrace.split(`
992
- `).length ? this.parseOpera9(c) : c.stack ? this.parseOpera11(c) : this.parseOpera10(c);
993
- },
994
- parseOpera9: function(c) {
995
- for (var d = /Line (\d+).*script (?:in )?(\S+)/i, u = c.message.split(`
996
- `), m = [], y = 2, g = u.length; y < g; y += 2) {
997
- var h = d.exec(u[y]);
998
- h && m.push(new s({ fileName: h[2], lineNumber: h[1], source: u[y] }));
999
- }
1000
- return m;
1001
- },
1002
- parseOpera10: function(c) {
1003
- for (var d = /Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i, u = c.stacktrace.split(`
1004
- `), m = [], y = 0, g = u.length; y < g; y += 2) {
1005
- var h = d.exec(u[y]);
1006
- h && m.push(new s({ functionName: h[3] || void 0, fileName: h[2], lineNumber: h[1], source: u[y] }));
1007
- }
1008
- return m;
1009
- },
1010
- // Opera 10.65+ Error.stack very similar to FF/Safari
1011
- parseOpera11: function(c) {
1012
- var d = c.stack.split(`
1013
- `).filter(function(u) {
1014
- return !!u.match(r) && !u.match(/^Error created at/);
1015
- }, this);
1016
- return d.map(function(u) {
1017
- var m = u.split("@"), y = this.extractLocation(m.pop()), g = m.shift() || "", h = g.replace(/<anonymous function(: (\w+))?>/, "$2").replace(/\([^)]*\)/g, "") || void 0, p;
1018
- g.match(/\(([^)]*)\)/) && (p = g.replace(/^[^(]+\(([^)]*)\)$/, "$1"));
1019
- var E = p === void 0 || p === "[arguments not available]" ? void 0 : p.split(",");
1020
- return new s({ functionName: h, args: E, fileName: y[0], lineNumber: y[1], columnNumber: y[2], source: u });
1021
- }, this);
1022
- }
1023
- };
1024
- });
1025
- }(ze)), ze.exports;
1026
- }
1027
- var Vo = Go();
1028
- const jo = /* @__PURE__ */ ns(Vo), ss = "global code", Ko = (n) => O(n) && /^global code$/i.test(n) ? ss : n, qo = (n) => {
1029
- const e = { file: n.fileName, method: Ko(n.functionName), lineNumber: n.lineNumber, columnNumber: n.columnNumber };
1030
- return e.lineNumber && e.lineNumber > -1 && !e.file && !e.method && (e.file = ss), e;
1031
- }, an = (n) => P(n) ? n : "";
1032
- function ln(n, e, t, s) {
1033
- return { errorClass: an(n), message: `${t}${an(e)}`, type: "browserjs", stacktrace: s.reduce((r, i) => {
1034
- const a = qo(i);
1035
- try {
1036
- return JSON.stringify(a) === "{}" ? r : r.concat(a);
1037
- } catch {
1038
- return r;
1039
- }
1040
- }, []) };
1041
- }
1042
- const Qo = (n, e) => {
1043
- let t;
1044
- return $t(n) && P(Bt(n)) ? t = n : (e.warn(Ri(ke, W(n))), t = void 0), t;
1045
- }, Wo = (n, e) => {
1046
- try {
1047
- const t = jo.parse(n);
1048
- return ln(n.name, n.message, e, t);
1049
- } catch {
1050
- return ln(n.name, n.message, e, []);
1051
- }
1052
- }, cn = (n, e) => {
1053
- try {
1054
- return JSON.parse(n || "");
1055
- } catch (t) {
1056
- const s = Be(t, "Failed to parse response data");
1057
- e(s);
1058
- }
1059
- }, Je = "The request failed", Xo = [Je], zo = { headers: { Accept: "application/json", "Content-Type": "application/json;charset=UTF-8" }, method: "GET" }, un = (n, e, t) => {
1060
- const s = L(zo, e || {});
1061
- return t && (s.headers = L(s.headers, { Authorization: t })), s.url = n, s;
1062
- }, dn = (n, e = Wr, t) => new Promise((s, r) => {
1063
- let i;
1064
- if (n.sendRawData === !0)
1065
- i = n.data;
1066
- else if (i = W(n.data, !1, [], t), j(i)) {
1067
- r({ error: new Error(vi), undefined: void 0, options: n });
1068
- return;
1069
- }
1070
- const a = new XMLHttpRequest(), l = (d) => {
1071
- r({ error: new Error($i(Je, a.status, a.statusText, n.url)), xhr: a, options: n });
1072
- }, c = (d) => {
1073
- r({ error: new Error(Mi(Je, d, n.url)), xhr: a, options: n });
1074
- };
1075
- a.ontimeout = c, a.onerror = c, a.onload = () => {
1076
- a.status >= 200 && a.status < 400 ? s({ response: a.responseText, xhr: a, options: n }) : l();
1077
- }, a.open(n.method, n.url, !0), n.withCredentials === !0 && (a.withCredentials = !0), a.timeout = e, Object.keys(n.headers).forEach((d) => {
1078
- n.headers[d] && a.setRequestHeader(d, n.headers[d]);
1079
- });
1080
- try {
1081
- a.send(i);
1082
- } catch (d) {
1083
- r({ error: Be(d, Ui(Je, n.url)), xhr: a, options: n });
1084
- }
1085
- });
1086
- class Yo {
1087
- constructor(e) {
1088
- this.logger = e, this.onError = this.onError.bind(this);
1089
- }
1090
- init(e) {
1091
- this.errorHandler = e;
1092
- }
1093
- /**
1094
- * Implement requests in a blocking way
1095
- */
1096
- async getData(e) {
1097
- const { url: t, options: s, timeout: r, isRawResponse: i } = e;
1098
- try {
1099
- const a = await dn(un(t, s, this.basicAuthHeader), r, this.logger);
1100
- return { data: i ? a.response : cn(a.response, this.onError), details: a };
1101
- } catch (a) {
1102
- return { data: void 0, details: a };
1103
- }
1104
- }
1105
- /**
1106
- * Implement requests in a non-blocking way
1107
- */
1108
- getAsyncData(e) {
1109
- const { callback: t, url: s, options: r, timeout: i, isRawResponse: a } = e, l = !v(t);
1110
- dn(un(s, r, this.basicAuthHeader), i, this.logger).then((c) => {
1111
- l || t(a ? c.response : cn(c.response, this.onError), c);
1112
- }).catch((c) => {
1113
- l || t(void 0, c);
1114
- });
1115
- }
1116
- /**
1117
- * Handle errors
1118
- */
1119
- onError(e) {
1120
- var t;
1121
- (t = this.errorHandler) == null || t.onError(e, Tr);
1122
- }
1123
- /**
1124
- * Set basic authentication header (eg writekey)
1125
- */
1126
- setAuthHeader(e, t = !1) {
1127
- const s = t ? e : Sr(`${e}:`);
1128
- this.basicAuthHeader = `Basic ${s}`;
1129
- }
1130
- /**
1131
- * Clear basic authentication header
1132
- */
1133
- resetAuthHeader() {
1134
- this.basicAuthHeader = void 0;
1135
- }
1136
- }
1137
- const rs = new Yo(X), Jo = "1", Zo = () => [
1138
- "rsa"
1139
- // Prefix for all the SDK scripts including plugins and module federated chunks
1140
- ], ea = ["www.test-host.com", "localhost", "127.0.0.1", "[::1]"], ta = [
1141
- "userId",
1142
- "userTraits",
1143
- "groupId",
1144
- "groupTraits",
1145
- "anonymousId",
1146
- "config",
1147
- "instance",
1148
- // destination instance objects
1149
- "eventBuffer",
1150
- // pre-load event buffer (may contain PII)
1151
- "traits",
1152
- "authToken"
1153
- ], na = "RudderStack JavaScript SDK", sa = "__REPOSITORY_URL__", ra = "js", ia = (n, e) => {
1154
- switch (e) {
1155
- case z.UNHANDLEDEXCEPTION: {
1156
- const { error: t } = n;
1157
- return t || n;
1158
- }
1159
- case z.UNHANDLEDREJECTION:
1160
- return n.reason;
1161
- case z.HANDLEDEXCEPTION:
1162
- default:
1163
- return n;
1164
- }
1165
- }, oa = (n) => ({ type: "manual", name: n, timestamp: /* @__PURE__ */ new Date(), metaData: {} }), aa = () => {
1166
- const n = globalThis.location.hostname;
1167
- return n && ea.includes(n) ? "development" : "production";
1168
- }, la = (n) => {
1169
- const e = W(n, !1, ta);
1170
- return e !== null ? JSON.parse(e) : {};
1171
- }, ca = () => globalThis.location.href.split("?")[0], ua = (n, e, t, s) => {
1172
- var r, i;
1173
- return { id: `${((r = n.value) == null ? void 0 : r.id) ?? t.writeKey.value}..${e.sessionInfo.value.id ?? "NA"}..${s.pageLifecycle.visitId.value ?? "NA"}`, name: ((i = n.value) == null ? void 0 : i.name) ?? "NA" };
1174
- }, da = (n, e) => ({ locale: n.value ?? "NA", userAgent: e.value ?? "NA", time: /* @__PURE__ */ new Date() }), fa = (n, e, t) => {
1175
- const { context: s, lifecycle: r, session: i, source: a, reporting: l, autoTrack: c } = t, { app: d, locale: u, userAgent: m, timezone: y, screen: g, library: h } = s;
1176
- return { payloadVersion: "5", notifier: { name: na, version: d.value.version, url: sa }, events: [{ exceptions: [S(n)], severity: e.severity, unhandled: e.unhandled, severityReason: e.severityReason, app: { version: d.value.version, releaseStage: aa(), type: d.value.installType }, device: da(u, m), request: { url: ca(), clientIp: "[NOT COLLECTED]" }, breadcrumbs: S(l.breadcrumbs.value), context: n.message, metaData: {
1177
- app: { snippetVersion: h.value.snippetVersion },
1178
- device: { ...g.value, timezone: y.value },
1179
- // Add rest of the state groups as metadata
1180
- // so that they show up as separate tabs in the dashboard
1181
- ...la(t)
1182
- }, user: ua(a, i, r, c) }] };
1183
- }, ga = (n) => !Xo.some((e) => n.message.includes(e)), ha = (n) => {
1184
- var i;
1185
- const e = (i = n.stacktrace[0]) == null ? void 0 : i.file;
1186
- if (!e || typeof e != "string")
1187
- return !1;
1188
- const t = e.substring(e.lastIndexOf("/") + 1), s = e.split("/");
1189
- return s[s.length - 2] === Ft || Zo().some((a) => t.startsWith(a) && t.endsWith(".js"));
1190
- }, pa = (n, e) => {
1191
- const t = { version: Jo, message_id: ot(), source: { name: ra, sdk_version: e.context.app.value.version, write_key: e.lifecycle.writeKey.value, install_type: e.context.app.value.installType }, errors: n };
1192
- return W(t);
1193
- };
1194
- class ma {
1195
- // If no logger is passed errors will be thrown as unhandled error
1196
- constructor(e, t) {
1197
- this.httpClient = e, this.logger = t, this.attachErrorListeners();
1198
- }
1199
- attachErrorListeners() {
1200
- globalThis.addEventListener("error", (e) => {
1201
- this.onError(e, ke, void 0, z.UNHANDLEDEXCEPTION);
1202
- }), globalThis.addEventListener("unhandledrejection", (e) => {
1203
- this.onError(e, ke, void 0, z.UNHANDLEDREJECTION);
1204
- });
1205
- }
1206
- onError(e, t = "", s = "", r = z.HANDLEDEXCEPTION) {
1207
- try {
1208
- const i = ia(e, r), a = Qo(i, this.logger);
1209
- if (w(a))
1210
- return;
1211
- const l = s ? `${s} - ` : "", c = `${t}${b}${l}`, d = Wo(a, c), m = Bt(a).includes(We);
1212
- if (!ha(d) && o.context.app.value.installType !== "npm" && !m && r !== z.HANDLEDEXCEPTION)
1213
- return;
1214
- if (o.reporting.isErrorReportingEnabled.value && ga(d)) {
1215
- const y = { severity: "error", unhandled: r !== z.HANDLEDEXCEPTION, severityReason: { type: r } }, g = fa(d, y, o);
1216
- this.httpClient.getAsyncData({ url: o.metrics.metricsServiceUrl.value, options: { method: "POST", data: pa(g, o), sendRawData: !0 }, isRawResponse: !0 });
1217
- }
1218
- (r === z.HANDLEDEXCEPTION || m) && this.logger.error(d.message);
1219
- } catch (i) {
1220
- this.logger.error(Ti(ke), i);
1221
- }
1222
- }
1223
- /**
1224
- * Add breadcrumbs to add insight of a user's journey before an error
1225
- * occurred and send to external error monitoring service via a plugin
1226
- *
1227
- * @param {string} breadcrumb breadcrumbs message
1228
- */
1229
- leaveBreadcrumb(e) {
1230
- try {
1231
- o.reporting.breadcrumbs.value = [...o.reporting.breadcrumbs.value, oa(e)];
1232
- } catch (t) {
1233
- this.onError(t, Ii(ke));
1234
- }
1235
- }
1236
- }
1237
- const va = new ma(rs, X);
1238
- class Ea {
1239
- constructor(e, t = {}) {
1240
- A(this, "plugins", []);
1241
- A(this, "byName", {});
1242
- A(this, "cache", {});
1243
- A(this, "config", { throws: !0 });
1244
- this.config = { throws: !0, ...t }, this.logger = e;
1245
- }
1246
- register(e, t) {
1247
- if (!e.name) {
1248
- const r = Oi(ge);
1249
- if (this.config.throws)
1250
- throw new Error(r);
1251
- this.logger.error(r, e);
1252
- return;
1253
- }
1254
- if (this.byName[e.name]) {
1255
- const r = Ai(ge, e.name);
1256
- if (this.config.throws)
1257
- throw new Error(r);
1258
- this.logger.error(r);
1259
- return;
1260
- }
1261
- this.cache = {}, this.plugins = this.plugins.slice();
1262
- let s = this.plugins.length;
1263
- this.plugins.forEach((r, i) => {
1264
- var a;
1265
- (a = r.deps) != null && a.includes(e.name) && (s = Math.min(s, i));
1266
- }), this.plugins.splice(s, 0, e), this.byName[e.name] = e, v(e.initialize) && e.initialize(t);
1267
- }
1268
- unregister(e) {
1269
- const t = this.byName[e];
1270
- if (!t) {
1271
- const r = Di(ge, e);
1272
- if (this.config.throws)
1273
- throw new Error(r);
1274
- this.logger.error(r);
1275
- return;
1276
- }
1277
- const s = this.plugins.indexOf(t);
1278
- if (s === -1) {
1279
- const r = ki(ge, e);
1280
- if (this.config.throws)
1281
- throw new Error(r);
1282
- this.logger.error(r);
1283
- return;
1284
- }
1285
- this.cache = {}, delete this.byName[e], this.plugins = this.plugins.slice(), this.plugins.splice(s, 1);
1286
- }
1287
- getPlugin(e) {
1288
- return this.byName[e];
1289
- }
1290
- getPlugins(e) {
1291
- const t = e ?? ".";
1292
- return this.cache[t] || (this.cache[t] = this.plugins.filter((s) => {
1293
- var r;
1294
- if ((r = s.deps) != null && r.some((i) => !this.byName[i])) {
1295
- const i = s.deps.filter((a) => !this.byName[a]);
1296
- return this.logger.error(Ci(ge, s.name, i)), !1;
1297
- }
1298
- return t === "." ? !0 : pr(s, t);
1299
- })), this.cache[t];
1300
- }
1301
- // This method allows to process this.plugins so that it could
1302
- // do some unified pre-process before application starts.
1303
- processRawPlugins(e) {
1304
- e(this.plugins), this.cache = {};
1305
- }
1306
- invoke(e, t = !0, ...s) {
1307
- let r = e;
1308
- if (!r)
1309
- throw new Error(Ei);
1310
- const i = r.startsWith("!"), a = this.config.throws ?? r.endsWith("!");
1311
- if (r = r.replace(/(^!|!$)/g, ""), !r)
1312
- throw new Error(yi);
1313
- const l = r.split(".");
1314
- l.pop();
1315
- const c = l.join(".");
1316
- return (t ? this.getPlugins(r) : [this.getPlugins(r)[0]]).map((u) => {
1317
- const m = yt(u, r);
1318
- if (!v(m) || i)
1319
- return m;
1320
- try {
1321
- return m.apply(yt(u, c), s);
1322
- } catch (y) {
1323
- if (a)
1324
- throw y;
1325
- this.logger.error(Ni(ge, r, u.name), y);
1326
- }
1327
- return null;
1328
- });
1329
- }
1330
- invokeSingle(e, ...t) {
1331
- return this.invoke(e, !1, ...t)[0];
1332
- }
1333
- invokeMultiple(e, ...t) {
1334
- return this.invoke(e, !0, ...t);
1335
- }
1336
- }
1337
- const ya = new Ea(X, { throws: !0 }), ba = (n) => n.config.connectionMode !== "cloud" || n.config.useNativeSDKToSend === !0 || // this is the older flag for hybrid mode destinations
1338
- n.config.useNativeSDK === !0, Sa = (n) => n.config.connectionMode === "hybrid" || n.config.useNativeSDKToSend === !0, fn = (n) => n.filter(ba), is = ["BeaconQueue", "CustomConsentManager", "DeviceModeDestinations", "DeviceModeTransformation", "ExternalAnonymousId", "GoogleLinker", "IubendaConsentManager", "KetchConsentManager", "NativeDestinationQueue", "OneTrustConsentManager", "StorageEncryption", "StorageEncryptionLegacy", "StorageMigrator", "XhrQueue"], _a = ["Bugsnag", "ErrorReporting"], Ra = {
1339
- rudderAnalyticsRemotePlugins: { url: () => Promise.resolve(window.RudderStackGlobals && window.RudderStackGlobals.app && window.RudderStackGlobals.app.pluginsCDNPath ? `${window.RudderStackGlobals.app.pluginsCDNPath}/rsa-plugins.js` : "https://cdn.rudderlabs.com/v3/modern/plugins//rsa-plugins.js"), format: "esm", from: "vite" }
1340
- };
1341
- function os(n, e) {
1342
- const t = Object.assign(n, e);
1343
- for (const s of Object.keys(t))
1344
- typeof t[s] == "object" && typeof e[s] == "object" && (t[s] = os(t[s], e[s]));
1345
- return t;
1346
- }
1347
- const Ia = (n) => os({}, (globalThis.__federation_shared__ || {}).default || {});
1348
- async function Ta(n) {
1349
- const e = Ra[n];
1350
- if (e.inited)
1351
- return e.lib;
1352
- if (["esm", "systemjs"].includes(e.format))
1353
- return new Promise((t, s) => {
1354
- (typeof e.url == "function" ? e.url : () => Promise.resolve(e.url))().then((i) => {
1355
- import(
1356
- /* webpackIgnore: true */
1357
- /* @vite-ignore */
1358
- i
1359
- ).then((a) => {
1360
- if (!e.inited) {
1361
- const l = Ia();
1362
- a.init(l), e.lib = a, e.lib.init(l), e.inited = !0;
1363
- }
1364
- t(e.lib);
1365
- }).catch(s);
1366
- });
1367
- });
1368
- }
1369
- function U(n, e) {
1370
- if (!(n != null && n.default) && e) {
1371
- let t = /* @__PURE__ */ Object.create(null);
1372
- return t.default = n, t.__esModule = !0, t;
1373
- }
1374
- return n;
1375
- }
1376
- function B(n, e) {
1377
- return Ta(n).then((t) => t.get(e).then((s) => s()));
1378
- }
1379
- const Oa = (n) => {
1380
- switch (n) {
1381
- case "BeaconQueue":
1382
- return () => B("rudderAnalyticsRemotePlugins", "./BeaconQueue").then((e) => U(e, !0));
1383
- case "CustomConsentManager":
1384
- return () => B("rudderAnalyticsRemotePlugins", "./CustomConsentManager").then((e) => U(e, !0));
1385
- case "DeviceModeDestinations":
1386
- return () => B("rudderAnalyticsRemotePlugins", "./DeviceModeDestinations").then((e) => U(e, !0));
1387
- case "DeviceModeTransformation":
1388
- return () => B("rudderAnalyticsRemotePlugins", "./DeviceModeTransformation").then((e) => U(e, !0));
1389
- case "ExternalAnonymousId":
1390
- return () => B("rudderAnalyticsRemotePlugins", "./ExternalAnonymousId").then((e) => U(e, !0));
1391
- case "GoogleLinker":
1392
- return () => B("rudderAnalyticsRemotePlugins", "./GoogleLinker").then((e) => U(e, !0));
1393
- case "KetchConsentManager":
1394
- return () => B("rudderAnalyticsRemotePlugins", "./KetchConsentManager").then((e) => U(e, !0));
1395
- case "IubendaConsentManager":
1396
- return () => B("rudderAnalyticsRemotePlugins", "./IubendaConsentManager").then((e) => U(e, !0));
1397
- case "NativeDestinationQueue":
1398
- return () => B("rudderAnalyticsRemotePlugins", "./NativeDestinationQueue").then((e) => U(e, !0));
1399
- case "OneTrustConsentManager":
1400
- return () => B("rudderAnalyticsRemotePlugins", "./OneTrustConsentManager").then((e) => U(e, !0));
1401
- case "StorageEncryption":
1402
- return () => B("rudderAnalyticsRemotePlugins", "./StorageEncryption").then((e) => U(e, !0));
1403
- case "StorageEncryptionLegacy":
1404
- return () => B("rudderAnalyticsRemotePlugins", "./StorageEncryptionLegacy").then((e) => U(e, !0));
1405
- case "StorageMigrator":
1406
- return () => B("rudderAnalyticsRemotePlugins", "./StorageMigrator").then((e) => U(e, !0));
1407
- case "XhrQueue":
1408
- return () => B("rudderAnalyticsRemotePlugins", "./XhrQueue").then((e) => U(e, !0));
1409
- default:
1410
- return;
1411
- }
1412
- }, ft = (n) => {
1413
- const e = {};
1414
- return n.forEach((t) => {
1415
- if (is.includes(t)) {
1416
- const s = Oa(t);
1417
- s && (e[t] = s);
1418
- }
1419
- }), e;
1420
- }, as = () => ({}), Aa = () => ({}), Da = (n) => (ft == null ? void 0 : ft(n)) || {}, gt = { ...as(), ...Aa() }, ka = (n) => ({ ...Da(n) });
1421
- class Ca {
1422
- constructor(e, t, s) {
1423
- this.engine = e, this.errorHandler = t, this.logger = s, this.onError = this.onError.bind(this);
1424
- }
1425
- /**
1426
- * Orchestrate the plugin loading and registering
1427
- */
1428
- init() {
1429
- o.lifecycle.status.value = "pluginsLoading", Me("pluginsCDNPath", o.lifecycle.pluginsCDNPath.value), this.setActivePlugins(), this.registerLocalPlugins(), this.registerRemotePlugins(), this.attachEffects();
1430
- }
1431
- /**
1432
- * Update state based on plugin loaded status
1433
- */
1434
- // eslint-disable-next-line class-methods-use-this
1435
- attachEffects() {
1436
- J(() => {
1437
- (o.plugins.activePlugins.value.length === 0 || o.plugins.loadedPlugins.value.length + o.plugins.failedPlugins.value.length === o.plugins.totalPluginsToLoad.value) && $(() => {
1438
- o.plugins.ready.value = !0, o.lifecycle.status.value = "pluginsReady";
1439
- });
1440
- });
1441
- }
1442
- /**
1443
- * Determine the list of plugins that should be loaded based on sourceConfig & load options
1444
- */
1445
- // eslint-disable-next-line class-methods-use-this
1446
- getPluginsToLoadBasedOnConfig() {
1447
- let e = o.plugins.pluginsToLoadFromConfig.value;
1448
- if (!e)
1449
- return [];
1450
- e = e.filter((r) => _a.includes(r) ? (this.logger.warn(ao(Ve, r)), !1) : !0);
1451
- const t = [{ configurationStatus: () => O(o.dataPlaneEvents.eventsQueuePluginName.value), configurationStatusStr: "Data plane events delivery is enabled", activePluginName: o.dataPlaneEvents.eventsQueuePluginName.value, supportedPlugins: Object.values(mo), shouldAddMissingPlugins: !0 }, { configurationStatus: () => fn(o.nativeDestinations.configuredDestinations.value).length > 0, configurationStatusStr: "Device mode destinations are connected to the source", supportedPlugins: ["DeviceModeDestinations", "NativeDestinationQueue"] }, { configurationStatus: () => fn(o.nativeDestinations.configuredDestinations.value).some((r) => r.shouldApplyDeviceModeTransformation), configurationStatusStr: "Device mode transformations are enabled for at least one destination", supportedPlugins: ["DeviceModeTransformation"] }, { configurationStatus: () => O(o.consents.activeConsentManagerPluginName.value), configurationStatusStr: "Consent management is enabled", activePluginName: o.consents.activeConsentManagerPluginName.value, supportedPlugins: Object.values(It) }, { configurationStatus: () => O(o.storage.encryptionPluginName.value), configurationStatusStr: "Storage encryption is enabled", activePluginName: o.storage.encryptionPluginName.value, supportedPlugins: Object.values(Xe) }, { configurationStatus: () => o.storage.migrate.value, configurationStatusStr: "Storage migration is enabled", supportedPlugins: ["StorageMigrator"] }], s = !1;
1452
- return t.forEach((r) => {
1453
- r.configurationStatus() ? (e = e.filter(
1454
- r.activePluginName ? (i) => !(i !== r.activePluginName && r.supportedPlugins.includes(i)) : (i) => O(i)
1455
- // pass through
1456
- ), this.addMissingPlugins(r, s, e)) : e = e.filter(r.basePlugins !== void 0 ? (i) => !(r.basePlugins.includes(i) || r.supportedPlugins.includes(i)) : (i) => !r.supportedPlugins.includes(i));
1457
- }), [...Object.keys(as()), ...e];
1458
- }
1459
- addMissingPlugins(e, t, s) {
1460
- const r = e.shouldAddMissingPlugins || t;
1461
- let i;
1462
- e.activePluginName ? i = [...e.basePlugins || [], e.activePluginName] : i = [...e.supportedPlugins];
1463
- const a = i.filter((l) => !s.includes(l));
1464
- a.length > 0 && (r && s.push(...a), this.logger.warn(lo(Ve, e.configurationStatusStr, a, r)));
1465
- }
1466
- /**
1467
- * Determine the list of plugins that should be activated
1468
- */
1469
- setActivePlugins() {
1470
- const e = this.getPluginsToLoadBasedOnConfig(), t = [...Object.keys(gt), ...is], s = [], r = [];
1471
- e.forEach((i) => {
1472
- t.includes(i) ? s.push(i) : r.push(i);
1473
- }), r.length > 0 && this.logger.warn(go(Ve, r)), $(() => {
1474
- o.plugins.totalPluginsToLoad.value = e.length, o.plugins.activePlugins.value = s, o.plugins.failedPlugins.value = r;
1475
- });
1476
- }
1477
- /**
1478
- * Register plugins that are direct imports to PluginEngine
1479
- */
1480
- registerLocalPlugins() {
1481
- Object.values(gt).forEach((e) => {
1482
- v(e) && o.plugins.activePlugins.value.includes(e().name) && this.register([e()]);
1483
- });
1484
- }
1485
- /**
1486
- * Register plugins that are dynamic imports to PluginEngine
1487
- */
1488
- registerRemotePlugins() {
1489
- const e = ka(o.plugins.activePlugins.value);
1490
- Promise.all(Object.keys(e).map(async (t) => {
1491
- await e[t]().then((s) => this.register([s.default()])).catch((s) => {
1492
- o.plugins.failedPlugins.value = [...o.plugins.failedPlugins.value, t], this.onError(s, t);
1493
- });
1494
- })).catch((t) => {
1495
- this.onError(t);
1496
- });
1497
- }
1498
- /**
1499
- * Extension point invoke that allows multiple plugins to be registered to it with error handling
1500
- */
1501
- invokeMultiple(e, ...t) {
1502
- try {
1503
- return this.engine.invokeMultiple(e, ...t);
1504
- } catch (s) {
1505
- return this.onError(s, e), [];
1506
- }
1507
- }
1508
- /**
1509
- * Extension point invoke that allows a single plugin to be registered to it with error handling
1510
- */
1511
- invokeSingle(e, ...t) {
1512
- try {
1513
- return this.engine.invokeSingle(e, ...t);
1514
- } catch (s) {
1515
- return this.onError(s, e), null;
1516
- }
1517
- }
1518
- /**
1519
- * Plugin engine register with error handling
1520
- */
1521
- register(e) {
1522
- e.forEach((t) => {
1523
- try {
1524
- this.engine.register(t, o);
1525
- } catch (s) {
1526
- o.plugins.failedPlugins.value = [...o.plugins.failedPlugins.value, t.name], this.onError(s);
1527
- }
1528
- });
1529
- }
1530
- // TODO: Implement reset API instead
1531
- unregisterLocalPlugins() {
1532
- Object.values(gt).forEach((e) => {
1533
- try {
1534
- this.engine.unregister(e().name);
1535
- } catch (t) {
1536
- this.onError(t);
1537
- }
1538
- });
1539
- }
1540
- /**
1541
- * Handle errors
1542
- */
1543
- onError(e, t) {
1544
- this.errorHandler.onError(e, Ve, t);
1545
- }
1546
- }
1547
- const F = "cookieStorage", x = "localStorage", G = "sessionStorage", Q = "memoryStorage", ue = "none", Na = "rl_user_id", Pa = "rl_trait", La = "rl_anonymous_id", wa = "rl_group_id", $a = "rl_group_trait", Ma = "rl_page_init_referrer", Ua = "rl_page_init_referring_domain", Ba = "rl_session", xa = "rl_auth_token", he = { userId: Na, userTraits: Pa, anonymousId: La, groupId: wa, groupTraits: $a, initialReferrer: Ma, initialReferringDomain: Ua, sessionInfo: Ba, authToken: xa }, Fa = "test_rudder_cookie", Ha = "test_rudder_ls", Ga = "test_rudder_ss", Va = "__tld__", ls = "clientDataInCookie", cs = "clientDataInLocalStorage", ja = "clientDataInMemory", us = "clientDataInSessionStorage", ds = ["userId", "userTraits", "anonymousId", "groupId", "groupTraits", "initialReferrer", "initialReferringDomain", "sessionInfo", "authToken"], pe = { [F]: ls, [x]: cs, [Q]: ja, [G]: us }, gn = (n, e) => {
1548
- try {
1549
- return encodeURIComponent(n);
1550
- } catch (t) {
1551
- e == null || e.error(Ur, t);
1552
- return;
1553
- }
1554
- }, hn = (n) => {
1555
- try {
1556
- return decodeURIComponent(n);
1557
- } catch {
1558
- return;
1559
- }
1560
- }, Ka = (n) => {
1561
- const e = {}, t = n.split(/\s*;\s*/);
1562
- let s;
1563
- return t[0] && t.forEach((r) => {
1564
- s = r.split("=");
1565
- const i = s[0] ? hn(s[0]) : void 0;
1566
- i && (e[i] = s[1] ? hn(s[1]) : void 0);
1567
- }), e;
1568
- }, qa = (n, e, t, s) => {
1569
- const r = { ...t || {} };
1570
- let i = `${gn(n, s)}=${gn(e, s)}`;
1571
- j(e) && (r.maxage = -1), r.maxage && (r.expires = new Date(+/* @__PURE__ */ new Date() + r.maxage)), r.path && (i += `; path=${r.path}`), r.domain && (i += `; domain=${r.domain}`), r.expires && (i += `; expires=${r.expires.toUTCString()}`), r.samesite && (i += `; samesite=${r.samesite}`), r.secure && (i += "; secure"), globalThis.document.cookie = i;
1572
- }, Tt = () => {
1573
- const n = globalThis.document.cookie;
1574
- return Ka(n);
1575
- }, Qa = (n) => Tt()[n], ne = function(n, e, t, s) {
1576
- switch (arguments.length) {
1577
- case 4:
1578
- case 3:
1579
- case 2:
1580
- return qa(n, e, t, s);
1581
- case 1:
1582
- return n ? Qa(n) : Tt();
1583
- default:
1584
- return Tt();
1585
- }
1586
- }, Wa = (n) => {
1587
- const e = new URL(o.lifecycle.sourceConfigUrl.value), t = `${e.origin}${e.pathname}?view=ad`;
1588
- n.getAsyncData({ url: t, options: {
1589
- // We actually don't need the response from the request, so we are using HEAD
1590
- method: "HEAD",
1591
- headers: { "Content-Type": void 0 }
1592
- }, isRawResponse: !0, callback: (s, r) => {
1593
- var i;
1594
- o.capabilities.isAdBlocked.value = (r == null ? void 0 : r.error) !== void 0 || ((i = r == null ? void 0 : r.xhr) == null ? void 0 : i.responseURL) !== t;
1595
- } });
1596
- }, Xa = () => !K(globalThis.crypto) && v(globalThis.crypto.getRandomValues), pn = () => !K(globalThis.navigator.userAgentData), za = () => !K(globalThis.navigator.sendBeacon) && v(globalThis.navigator.sendBeacon), Ya = () => !!globalThis.navigator.userAgent.match(/Trident.*rv:11\./), Ja = (n, e = "none") => {
1597
- var t;
1598
- e === "none" && n(void 0), e === "default" && n(navigator.userAgentData), e === "full" && ((t = navigator.userAgentData) == null || t.getHighEntropyValues(["architecture", "bitness", "brands", "mobile", "model", "platform", "platformVersion", "uaFullVersion", "fullVersionList", "wow64"]).then((s) => {
1599
- n(s);
1600
- }).catch(() => {
1601
- n();
1602
- }));
1603
- }, Za = () => {
1604
- const n = globalThis.document.createElement("div");
1605
- return n.setAttribute("data-a-b", "c"), n.dataset ? n.dataset.aB === "c" : !1;
1606
- }, Ot = {
1607
- // Ideally, we should separate the checks for URL and URLSearchParams but
1608
- // the polyfill service serves them under the same feature name, "URL".
1609
- URL: () => !v(globalThis.URL) || !v(globalThis.URLSearchParams),
1610
- Promise: () => !v(globalThis.Promise),
1611
- "Number.isNaN": () => !v(globalThis.Number.isNaN),
1612
- "Number.isInteger": () => !v(globalThis.Number.isInteger),
1613
- "Array.from": () => !v(globalThis.Array.from),
1614
- "Array.prototype.find": () => !v(globalThis.Array.prototype.find),
1615
- "Array.prototype.includes": () => !v(globalThis.Array.prototype.includes),
1616
- "String.prototype.endsWith": () => !v(globalThis.String.prototype.endsWith),
1617
- "String.prototype.startsWith": () => !v(globalThis.String.prototype.startsWith),
1618
- "String.prototype.includes": () => !v(globalThis.String.prototype.includes),
1619
- "String.prototype.replaceAll": () => !v(globalThis.String.prototype.replaceAll),
1620
- "String.fromCodePoint": () => !v(globalThis.String.fromCodePoint),
1621
- "Object.entries": () => !v(globalThis.Object.entries),
1622
- "Object.values": () => !v(globalThis.Object.values),
1623
- "Object.assign": () => !v(globalThis.Object.assign),
1624
- "Object.fromEntries": () => !v(globalThis.Object.fromEntries),
1625
- "Element.prototype.dataset": () => !Za(),
1626
- // Ideally, we should separate the checks for TextEncoder and TextDecoder but
1627
- // the polyfill service serves them under the same feature name, "TextEncoder".
1628
- TextEncoder: () => !v(globalThis.TextEncoder) || !v(globalThis.TextDecoder),
1629
- requestAnimationFrame: () => !v(globalThis.requestAnimationFrame) || !v(globalThis.cancelAnimationFrame),
1630
- CustomEvent: () => !v(globalThis.CustomEvent),
1631
- "navigator.sendBeacon": () => !v(globalThis.navigator.sendBeacon),
1632
- // Note, the polyfill service serves both ArrayBuffer and Uint8Array under the same feature name, "ArrayBuffer".
1633
- ArrayBuffer: () => !v(globalThis.Uint8Array),
1634
- Set: () => !v(globalThis.Set),
1635
- atob: () => !v(globalThis.atob)
1636
- }, el = () => {
1637
- const n = Object.keys(Ot);
1638
- let e = !1;
1639
- for (let t = 0; t < n.length; t++) {
1640
- const s = Ot[n[t]];
1641
- if (v(s) && s()) {
1642
- e = !0;
1643
- break;
1644
- }
1645
- }
1646
- return e;
1647
- }, mn = () => {
1648
- let n = { density: 0, width: 0, height: 0, innerWidth: 0, innerHeight: 0 };
1649
- return n = { width: globalThis.screen.width, height: globalThis.screen.height, density: globalThis.devicePixelRatio, innerWidth: globalThis.innerWidth, innerHeight: globalThis.innerHeight }, n;
1650
- }, fs = (n) => {
1651
- const e = ["QuotaExceededError", "NS_ERROR_DOM_QUOTA_REACHED"], t = [22, 1014], s = e.includes(n.name) || t.includes(n.code);
1652
- return n instanceof DOMException && s;
1653
- }, Ee = (n = x, e, t) => {
1654
- let s, r;
1655
- const i = Pi(bt, n);
1656
- let a = "unavailable", l = !0, c;
1657
- try {
1658
- switch (n) {
1659
- case Q:
1660
- return !0;
1661
- case F:
1662
- s = e, r = Fa;
1663
- break;
1664
- case x:
1665
- s = e ?? globalThis.localStorage, r = Ha;
1666
- break;
1667
- case G:
1668
- s = e ?? globalThis.sessionStorage, r = Ga;
1669
- break;
1670
- default:
1671
- return !1;
1672
- }
1673
- if (s && (s.setItem(r, "true"), s.getItem(r)))
1674
- return s.removeItem(r), !0;
1675
- l = !1;
1676
- } catch (d) {
1677
- l = !1, c = d, fs(d) && (a = "full");
1678
- }
1679
- return l || t == null || t.warn(`${i}${a}.`, c), !1;
1680
- }, tl = (n) => {
1681
- const e = document.createElement("a");
1682
- return e.href = n, e.hostname;
1683
- }, nl = (n) => {
1684
- const e = typeof globalThis.URL != "function" ? tl(n) : new URL(n).hostname, t = (e == null ? void 0 : e.split(".")) ?? [], s = t[t.length - 1], r = [];
1685
- if (t.length === 4 && s && s === parseInt(s, 10).toString())
1686
- return r;
1687
- if (t.length <= 1)
1688
- return t[0] && t[0].indexOf("localhost") !== -1 ? ["localhost"] : r;
1689
- for (let i = t.length - 2; i >= 0; i -= 1)
1690
- r.push(t.slice(i).join("."));
1691
- return r;
1692
- }, sl = (n) => {
1693
- const e = nl(n);
1694
- for (let t = 0; t < e.length; t += 1) {
1695
- const s = e[t], r = Va, i = { domain: `${s.indexOf("localhost") !== -1 ? "" : "."}${s}` };
1696
- if (ne(r, 1, i), ne(r))
1697
- return ne(r, null, i), s;
1698
- }
1699
- return "";
1700
- }, rl = () => {
1701
- const n = `.${sl(globalThis.location.href)}`;
1702
- return { maxage: Xr, path: "/", domain: !n || n === "." ? void 0 : n, samesite: "Lax", enabled: !0 };
1703
- }, il = () => ({ enabled: !0 }), ol = () => ({ enabled: !0 }), al = () => ({ enabled: !0 }), me = class me {
1704
- constructor(e = {}, t) {
1705
- A(this, "isSupportAvailable", !0);
1706
- A(this, "isEnabled", !0);
1707
- A(this, "length", 0);
1708
- if (me.globalSingleton)
1709
- return me.globalSingleton;
1710
- this.options = rl(), this.logger = t, this.configure(e), me.globalSingleton = this;
1711
- }
1712
- configure(e) {
1713
- return this.options = L(this.options ?? {}, e), e.sameDomainCookiesOnly && delete this.options.domain, this.isSupportAvailable = Ee(F, this), this.isEnabled = !!(this.options.enabled && this.isSupportAvailable), this.options;
1714
- }
1715
- setItem(e, t) {
1716
- return ne(e, t, this.options, this.logger), this.length = Object.keys(ne()).length, !0;
1717
- }
1718
- // eslint-disable-next-line class-methods-use-this
1719
- getItem(e) {
1720
- const t = ne(e);
1721
- return w(t) ? null : t;
1722
- }
1723
- removeItem(e) {
1724
- const t = this.setItem(e, null);
1725
- return this.length = Object.keys(ne()).length, t;
1726
- }
1727
- // eslint-disable-next-line class-methods-use-this
1728
- clear() {
1729
- }
1730
- key(e) {
1731
- return this.keys()[e] ?? null;
1732
- }
1733
- // eslint-disable-next-line class-methods-use-this
1734
- keys() {
1735
- return Object.keys(ne());
1736
- }
1737
- };
1738
- A(me, "globalSingleton", null);
1739
- let it = me;
1740
- class ll {
1741
- constructor(e, t) {
1742
- A(this, "isEnabled", !0);
1743
- A(this, "length", 0);
1744
- A(this, "data", {});
1745
- this.options = al(), this.logger = t, this.configure(e ?? {});
1746
- }
1747
- configure(e) {
1748
- return this.options = L(this.options, e), this.isEnabled = !!this.options.enabled, this.options;
1749
- }
1750
- setItem(e, t) {
1751
- return this.data[e] = t, this.length = Object.keys(this.data).length, t;
1752
- }
1753
- getItem(e) {
1754
- return e in this.data ? this.data[e] : null;
1755
- }
1756
- removeItem(e) {
1757
- return e in this.data && delete this.data[e], this.length = Object.keys(this.data).length, null;
1758
- }
1759
- clear() {
1760
- this.data = {}, this.length = 0;
1761
- }
1762
- key(e) {
1763
- return this.keys()[e] ?? null;
1764
- }
1765
- keys() {
1766
- return Object.keys(this.data);
1767
- }
1768
- }
1769
- const At = new ll({}, X);
1770
- var Ze = { exports: {} }, cl = Ze.exports, vn;
1771
- function ul() {
1772
- return vn || (vn = 1, function(n, e) {
1773
- (function(t, s) {
1774
- n.exports = s();
1775
- })(cl, function() {
1776
- function t(g) {
1777
- return g = JSON.stringify(g), !!/^\{[\s\S]*\}$/.test(g);
1778
- }
1779
- function s(g) {
1780
- return g === void 0 || typeof g == "function" ? g + "" : JSON.stringify(g);
1781
- }
1782
- function r(g) {
1783
- if (typeof g == "string")
1784
- try {
1785
- return JSON.parse(g);
1786
- } catch {
1787
- return g;
1788
- }
1789
- }
1790
- function i(g) {
1791
- return {}.toString.call(g) === "[object Function]";
1792
- }
1793
- function a(g) {
1794
- return Object.prototype.toString.call(g) === "[object Array]";
1795
- }
1796
- function l(g) {
1797
- var h = "_Is_Incognit", p = "yes";
1798
- try {
1799
- g || (g = window.localStorage), g.setItem(h, p), g.removeItem(h);
1800
- } catch {
1801
- var E = {};
1802
- E._data = {}, E.setItem = function(C, _e) {
1803
- return E._data[C] = String(_e);
1804
- }, E.getItem = function(C) {
1805
- return E._data.hasOwnProperty(C) ? E._data[C] : void 0;
1806
- }, E.removeItem = function(C) {
1807
- return delete E._data[C];
1808
- }, E.clear = function() {
1809
- return E._data = {};
1810
- }, g = E;
1811
- } finally {
1812
- g.getItem(h) === p && g.removeItem(h);
1813
- }
1814
- return g;
1815
- }
1816
- var c = l();
1817
- function d() {
1818
- if (!(this instanceof d))
1819
- return new d();
1820
- }
1821
- d.prototype = { set: function(h, p) {
1822
- if (h && !t(h))
1823
- c.setItem(h, s(p));
1824
- else if (t(h))
1825
- for (var E in h) this.set(E, h[E]);
1826
- return this;
1827
- }, get: function(h) {
1828
- if (h === void 0) {
1829
- var p = {};
1830
- return this.forEach(function(He, Re) {
1831
- return p[He] = Re;
1832
- }), p;
1833
- }
1834
- if (h.charAt(0) === "?")
1835
- return this.has(h.substr(1));
1836
- var E = arguments;
1837
- if (E.length > 1) {
1838
- for (var T = {}, C = 0, _e = E.length; C < _e; C++) {
1839
- var lt = r(c.getItem(E[C]));
1840
- this.has(E[C]) && (T[E[C]] = lt);
1841
- }
1842
- return T;
1843
- }
1844
- return r(c.getItem(h));
1845
- }, clear: function() {
1846
- return c.clear(), this;
1847
- }, remove: function(h) {
1848
- var p = this.get(h);
1849
- return c.removeItem(h), p;
1850
- }, has: function(h) {
1851
- return {}.hasOwnProperty.call(this.get(), h);
1852
- }, keys: function() {
1853
- var h = [];
1854
- return this.forEach(function(p) {
1855
- h.push(p);
1856
- }), h;
1857
- }, forEach: function(h) {
1858
- for (var p = 0, E = c.length; p < E; p++) {
1859
- var T = c.key(p);
1860
- h(T, this.get(T));
1861
- }
1862
- return this;
1863
- }, search: function(h) {
1864
- for (var p = this.keys(), E = {}, T = 0, C = p.length; T < C; T++)
1865
- p[T].indexOf(h) > -1 && (E[p[T]] = this.get(p[T]));
1866
- return E;
1867
- }, len: function() {
1868
- return c.length;
1869
- } };
1870
- var u = null;
1871
- function m(g, h) {
1872
- var p = arguments, E = null;
1873
- if (u || (u = d()), p.length === 0) return u.get();
1874
- if (p.length === 1) {
1875
- if (typeof g == "string") return u.get(g);
1876
- if (t(g)) return u.set(g);
1877
- }
1878
- if (p.length === 2 && typeof g == "string") {
1879
- if (!h) return u.remove(g);
1880
- if (h && typeof h == "string") return u.set(g, h);
1881
- h && i(h) && (E = null, E = h(g, u.get(g)), m.set(g, E));
1882
- }
1883
- if (p.length === 2 && a(g) && i(h))
1884
- for (var T = 0, C = g.length; T < C; T++)
1885
- E = h(g[T], u.get(g[T])), m.set(g[T], E);
1886
- return m;
1887
- }
1888
- for (var y in d.prototype) m[y] = d.prototype[y];
1889
- return m;
1890
- });
1891
- }(Ze)), Ze.exports;
1892
- }
1893
- var dl = ul();
1894
- const oe = /* @__PURE__ */ ns(dl);
1895
- class fl {
1896
- constructor(e = {}, t) {
1897
- A(this, "isSupportAvailable", !0);
1898
- A(this, "isEnabled", !0);
1899
- A(this, "length", 0);
1900
- this.options = il(), this.logger = t, this.configure(e);
1901
- }
1902
- configure(e) {
1903
- return this.options = L(this.options, e), this.isSupportAvailable = Ee(x), this.isEnabled = !!(this.options.enabled && this.isSupportAvailable), this.options;
1904
- }
1905
- setItem(e, t) {
1906
- oe.set(e, t), this.length = oe.len();
1907
- }
1908
- // eslint-disable-next-line class-methods-use-this
1909
- getItem(e) {
1910
- const t = oe.get(e);
1911
- return w(t) ? null : t;
1912
- }
1913
- removeItem(e) {
1914
- oe.remove(e), this.length = oe.len();
1915
- }
1916
- clear() {
1917
- oe.clear(), this.length = 0;
1918
- }
1919
- key(e) {
1920
- return this.keys()[e] ?? null;
1921
- }
1922
- // eslint-disable-next-line class-methods-use-this
1923
- keys() {
1924
- return oe.keys();
1925
- }
1926
- }
1927
- const gs = new fl({}, X);
1928
- class gl {
1929
- constructor(e = {}, t) {
1930
- A(this, "isSupportAvailable", !0);
1931
- A(this, "isEnabled", !0);
1932
- A(this, "length", 0);
1933
- this.options = ol(), this.logger = t, this.configure(e);
1934
- }
1935
- configure(e) {
1936
- return this.options = L(this.options, e), this.isSupportAvailable = Ee(G), this.isSupportAvailable && (this.store = globalThis.sessionStorage), this.isEnabled = !!(this.options.enabled && this.isSupportAvailable), this.options;
1937
- }
1938
- setItem(e, t) {
1939
- this.store && (this.store.setItem(e, t), this.length = this.store.length);
1940
- }
1941
- getItem(e) {
1942
- if (!this.store)
1943
- return null;
1944
- const t = this.store.getItem(e);
1945
- return w(t) ? null : t;
1946
- }
1947
- removeItem(e) {
1948
- this.store && (this.store.removeItem(e), this.length = this.store.length);
1949
- }
1950
- clear() {
1951
- var e;
1952
- (e = this.store) == null || e.clear(), this.length = 0;
1953
- }
1954
- key(e) {
1955
- var t;
1956
- return ((t = this.store) == null ? void 0 : t.key(e)) ?? null;
1957
- }
1958
- keys() {
1959
- const e = [];
1960
- if (!this.store)
1961
- return e;
1962
- for (let t = 0; t < this.store.length; t += 1) {
1963
- const s = this.store.key(t);
1964
- s !== null && e.push(s);
1965
- }
1966
- return e;
1967
- }
1968
- }
1969
- const hs = new gl({}, X), H = (n) => {
1970
- switch (n) {
1971
- case x:
1972
- return gs;
1973
- case G:
1974
- return hs;
1975
- case Q:
1976
- return At;
1977
- case F:
1978
- return new it({}, X);
1979
- default:
1980
- return At;
1981
- }
1982
- }, hl = (n) => {
1983
- const e = new it({}, X).configure(n);
1984
- o.storage.cookie.value = { maxage: e.maxage, path: e.path, domain: e.domain, samesite: e.samesite, expires: e.expires, secure: e.secure };
1985
- }, pl = (n) => {
1986
- gs.configure(n);
1987
- }, ml = (n) => {
1988
- At.configure(n);
1989
- }, vl = (n) => {
1990
- hs.configure(n);
1991
- }, El = (n = {}, e = {}, t = {}, s = {}) => {
1992
- hl(n), pl(e), ml(t), vl(s);
1993
- };
1994
- class yl {
1995
- constructor(e, t, s) {
1996
- this.id = e.id, this.name = e.name, this.isEncrypted = e.isEncrypted ?? !1, this.validKeys = e.validKeys ?? {}, this.engine = t ?? H(x), this.noKeyValidation = Object.keys(this.validKeys).length === 0, this.noCompoundKey = e.noCompoundKey, this.originalEngine = this.engine, this.errorHandler = e.errorHandler, this.logger = e.logger, this.pluginsManager = s;
1997
- }
1998
- /**
1999
- * Ensure the key is valid and with correct format
2000
- */
2001
- createValidKey(e) {
2002
- const { name: t, id: s, validKeys: r, noKeyValidation: i, noCompoundKey: a } = this;
2003
- if (i)
2004
- return a ? e : [t, s, e].join(".");
2005
- let l;
2006
- return Object.values(r).forEach((c) => {
2007
- c === e && (l = a ? e : [t, s, e].join("."));
2008
- }), l;
2009
- }
2010
- /**
2011
- * Switch to inMemoryEngine, bringing any existing data with.
2012
- */
2013
- swapQueueStoreToInMemoryEngine() {
2014
- const { name: e, id: t, validKeys: s, noCompoundKey: r } = this, i = H(Q);
2015
- Object.keys(s).forEach((a) => {
2016
- const l = this.get(s[a]), c = r ? a : [e, t, a].join(".");
2017
- i.setItem(c, l), this.remove(a);
2018
- }), this.engine = i;
2019
- }
2020
- /**
2021
- * Set value by key.
2022
- */
2023
- set(e, t) {
2024
- const s = this.createValidKey(e);
2025
- if (s)
2026
- try {
2027
- this.engine.setItem(s, this.encrypt(W(t, !1, [], this.logger)));
2028
- } catch (r) {
2029
- fs(r) ? (this.logger.warn(eo(`Store ${this.id}`)), this.swapQueueStoreToInMemoryEngine(), this.set(e, t)) : this.onError(Be(r, Bi(e)));
2030
- }
2031
- }
2032
- /**
2033
- * Get by Key.
2034
- */
2035
- get(e) {
2036
- const t = this.createValidKey(e);
2037
- let s;
2038
- try {
2039
- return !t || (s = this.decrypt(this.engine.getItem(t)), K(s)) ? null : JSON.parse(s);
2040
- } catch (r) {
2041
- return this.onError(new Error(`${xi(e)}: ${r.message}`)), P(s) && s.startsWith("RudderEncrypt:") && this.logger.warn(uo(e)), null;
2042
- }
2043
- }
2044
- /**
2045
- * Remove by Key.
2046
- */
2047
- remove(e) {
2048
- const t = this.createValidKey(e);
2049
- t && this.engine.removeItem(t);
2050
- }
2051
- /**
2052
- * Get original engine
2053
- */
2054
- getOriginalEngine() {
2055
- return this.originalEngine;
2056
- }
2057
- /**
2058
- * Decrypt values
2059
- */
2060
- decrypt(e) {
2061
- return K(e) ? null : this.crypto(e, "decrypt");
2062
- }
2063
- /**
2064
- * Encrypt value
2065
- */
2066
- encrypt(e) {
2067
- return this.crypto(e, "encrypt");
2068
- }
2069
- /**
2070
- * Extension point to use with encryption plugins
2071
- */
2072
- crypto(e, t) {
2073
- if (!this.isEncrypted || !e || typeof e != "string" || yr(e) === "")
2074
- return e;
2075
- const r = `storage.${t}`, i = this.pluginsManager ? this.pluginsManager.invokeSingle(r, e) : e;
2076
- return typeof i > "u" ? e : i ?? "";
2077
- }
2078
- /**
2079
- * Handle errors
2080
- */
2081
- onError(e) {
2082
- this.errorHandler.onError(e, `Store ${this.id}`);
2083
- }
2084
- }
2085
- const bl = (n, e) => {
2086
- var s;
2087
- let t;
2088
- if (n.consents.preConsent.value.enabled)
2089
- switch ((s = n.consents.preConsent.value.storage) == null ? void 0 : s.strategy) {
2090
- case "none":
2091
- t = ue;
2092
- break;
2093
- case "session":
2094
- e !== "sessionInfo" && (t = ue);
2095
- break;
2096
- case "anonymousId":
2097
- e !== "anonymousId" && (t = ue);
2098
- break;
2099
- }
2100
- return t;
2101
- };
2102
- class Sl {
2103
- constructor(e, t, s) {
2104
- A(this, "stores", {});
2105
- A(this, "isInitialized", !1);
2106
- this.errorHandler = t, this.logger = s, this.pluginsManager = e;
2107
- }
2108
- /**
2109
- * Configure available storage client instances
2110
- */
2111
- init() {
2112
- var s;
2113
- if (this.isInitialized)
2114
- return;
2115
- const e = o.loadOptions.value, t = { cookieStorageOptions: { samesite: e.sameSiteCookie, secure: e.secureCookie, domain: e.setCookieDomain, sameDomainCookiesOnly: e.sameDomainCookiesOnly, enabled: !0 }, localStorageOptions: { enabled: !0 }, inMemoryStorageOptions: { enabled: !0 }, sessionStorageOptions: { enabled: !0 } };
2116
- El(Ae(L(t.cookieStorageOptions, ((s = o.storage.cookie) == null ? void 0 : s.value) ?? {})), Ae(t.localStorageOptions), Ae(t.inMemoryStorageOptions), Ae(t.sessionStorageOptions)), this.initClientDataStores(), this.isInitialized = !0;
2117
- }
2118
- /**
2119
- * Create store to persist data used by the SDK like session, used details etc
2120
- */
2121
- initClientDataStores() {
2122
- this.initializeStorageState(), [Q, x, F, G].forEach((t) => {
2123
- var s;
2124
- (s = H(t)) != null && s.isEnabled && this.setStore({ id: pe[t], name: pe[t], isEncrypted: !0, noCompoundKey: !0, type: t, errorHandler: this.errorHandler, logger: this.logger });
2125
- });
2126
- }
2127
- initializeStorageState() {
2128
- var a;
2129
- let e = o.storage.type.value, t = (a = o.loadOptions.value.storage) == null ? void 0 : a.entries;
2130
- const s = o.consents.postConsent.value.storage;
2131
- (O(s == null ? void 0 : s.type) || O(s == null ? void 0 : s.entries)) && (e = s == null ? void 0 : s.type, t = s == null ? void 0 : s.entries);
2132
- let r = !0, i = {};
2133
- ds.forEach((l) => {
2134
- var h;
2135
- const c = l, d = l, u = (h = t == null ? void 0 : t[c]) == null ? void 0 : h.type, y = bl(o, l) ?? u ?? e ?? Rt, g = this.getResolvedStorageTypeForEntry(y, l);
2136
- g !== ue && (r = !1), i = { ...i, [l]: { type: g, key: he[d] } };
2137
- }), $(() => {
2138
- o.storage.type.value = e, o.storage.entries.value = i, o.storage.trulyAnonymousTracking.value = r;
2139
- });
2140
- }
2141
- getResolvedStorageTypeForEntry(e, t) {
2142
- var r, i, a, l, c;
2143
- let s = e;
2144
- switch (e) {
2145
- case x:
2146
- (r = H(x)) != null && r.isEnabled || (s = Q);
2147
- break;
2148
- case G:
2149
- (i = H(G)) != null && i.isEnabled || (s = Q);
2150
- break;
2151
- case Q:
2152
- case ue:
2153
- break;
2154
- case F:
2155
- default:
2156
- (a = H(F)) != null && a.isEnabled ? s = F : (l = H(x)) != null && l.isEnabled ? s = x : (c = H(G)) != null && c.isEnabled ? s = G : s = Q;
2157
- break;
2158
- }
2159
- return s !== e && this.logger.warn(to(_r, t, e, s)), s;
2160
- }
2161
- /**
2162
- * Create a new store
2163
- */
2164
- setStore(e) {
2165
- const t = H(e.type);
2166
- return this.stores[e.id] = new yl(e, t, this.pluginsManager), this.stores[e.id];
2167
- }
2168
- /**
2169
- * Retrieve a store
2170
- */
2171
- getStore(e) {
2172
- return this.stores[e];
2173
- }
2174
- }
2175
- const _l = (n) => k(n) && k(n.source) && !K(n.source.id) && k(n.source.config) && Array.isArray(n.source.destinations), Rl = (n) => typeof n == "string" && Wn.includes(n), ps = (n) => {
2176
- const e = new URL(n), { host: t, protocol: s } = e, r = t.split(".");
2177
- let i;
2178
- return r.length > 2 ? i = `${r[r.length - 2]}.${r[r.length - 1]}` : i = t, { topDomain: i, protocol: s };
2179
- }, Il = (n) => {
2180
- const { topDomain: e, protocol: t } = ps(n);
2181
- return `${t}//${e}`;
2182
- }, Tl = (n, e) => {
2183
- const t = e ? window.location.origin : Il(window.location.href), s = n.startsWith("/") ? n.substring(1) : n;
2184
- return `${t}/${s}`;
2185
- }, Ol = (n) => {
2186
- const { topDomain: e } = ps(window.location.href);
2187
- return e === n;
2188
- }, Al = (n) => {
2189
- const e = [];
2190
- return n.forEach((t) => {
2191
- t.enabled && !t.deleted && e.push({ id: t.id, displayName: t.destinationDefinition.displayName, config: t.config, shouldApplyDeviceModeTransformation: t.shouldApplyDeviceModeTransformation || !1, propagateEventsUntransformedOnError: t.propagateEventsUntransformedOnError || !1, userFriendlyId: `${t.destinationDefinition.displayName.replaceAll(" ", "-")}___${t.id}` });
2192
- }), e;
2193
- }, be = (n) => n != null && n.endsWith("/") ? be(n.substring(0, n.length - 1)) : n, Dt = (n) => {
2194
- try {
2195
- return new URL(n).host;
2196
- } catch {
2197
- return null;
2198
- }
2199
- }, ms = (n) => Dt(n) ?? "", Dl = (n) => {
2200
- const e = {};
2201
- try {
2202
- const t = new URL(n), s = "utm_";
2203
- t.searchParams.forEach((r, i) => {
2204
- if (i.startsWith(s)) {
2205
- let a = i.substring(s.length);
2206
- a === "campaign" && (a = "name"), e[a] = r;
2207
- }
2208
- });
2209
- } catch {
2210
- }
2211
- return e;
2212
- }, kl = (n) => {
2213
- let e = n;
2214
- try {
2215
- const t = new URL(n);
2216
- e = t.origin + t.pathname + t.search;
2217
- } catch {
2218
- }
2219
- return e;
2220
- }, Cl = (n) => n.replace(/\/{2,}/g, "/"), Se = (n) => {
2221
- if (!P(n))
2222
- return !1;
2223
- try {
2224
- return v(globalThis.URL) && new URL(n), ho.test(n);
2225
- } catch {
2226
- return !1;
2227
- }
2228
- }, Nl = () => {
2229
- var n, e;
2230
- return !!((e = (n = window.chrome) == null ? void 0 : n.runtime) != null && e.id);
2231
- }, ht = "none", pt = "immediate", Pl = (n) => {
2232
- var e, t;
2233
- return ((t = (e = n == null ? void 0 : n.statsCollection) == null ? void 0 : e.errors) == null ? void 0 : t.enabled) === !0;
2234
- }, Ll = (n) => {
2235
- var e, t;
2236
- return ((t = (e = n == null ? void 0 : n.statsCollection) == null ? void 0 : e.metrics) == null ? void 0 : t.enabled) === !0;
2237
- }, wl = (n) => {
2238
- const e = { sendPageEvent: !1, trackConsent: !1, discardPreConsentEvents: !1 };
2239
- if (k(n)) {
2240
- const t = S(n);
2241
- e.storage = t.storage, ie(t.integrations) && (e.integrations = t.integrations), e.discardPreConsentEvents = t.discardPreConsentEvents === !0, e.sendPageEvent = t.sendPageEvent === !0, e.trackConsent = t.trackConsent === !0, ie(t.consentManagement) && (e.consentManagement = L(t.consentManagement, { enabled: o.consents.enabled.value }));
2242
- }
2243
- return e;
2244
- }, En = (n) => ie(n) || Array.isArray(n), $l = (n, e) => {
2245
- let { provider: t } = n;
2246
- const s = t ? It[t] : void 0;
2247
- return t && !s && (e.error(_i(V, t, It)), t = void 0), { provider: t, consentManagerPluginName: s };
2248
- }, vs = (n, e) => {
2249
- let t, s = [], r = [], i = !1, a, l = (n == null ? void 0 : n.enabled) === !0;
2250
- ie(n) && l && ({ provider: a, consentManagerPluginName: t } = $l(n, e), En(n.allowedConsentIds) && (s = n.allowedConsentIds, i = !0), En(n.deniedConsentIds) && (r = n.deniedConsentIds, i = !0));
2251
- const c = { allowedConsentIds: s, deniedConsentIds: r };
2252
- return l = l && !!t, { provider: a, consentManagerPluginName: t, initialized: i, enabled: l, consentsData: c };
2253
- }, Ml = () => {
2254
- const n = document.querySelector("script[data-rsa-write-key]");
2255
- if (n && n.dataset.rsaWriteKey === o.lifecycle.writeKey.value)
2256
- return n.src;
2257
- const e = document.getElementsByTagName("script"), t = /(?:^|\/)rsa(\.min)?\.js$/;
2258
- for (const s of e) {
2259
- const r = s.getAttribute("src");
2260
- if (r && t.test(r))
2261
- return r;
2262
- }
2263
- }, Ul = (n) => {
2264
- o.reporting.isErrorReportingEnabled.value = Pl(n.source.config) && !Nl(), o.reporting.isMetricsReportingEnabled.value = Ll(n.source.config);
2265
- }, Bl = (n) => {
2266
- const { useServerSideCookies: e, dataServiceEndpoint: t, storage: s, setCookieDomain: r, sameDomainCookiesOnly: i } = o.loadOptions.value;
2267
- let a = s == null ? void 0 : s.cookie, l = !1, c;
2268
- if (e) {
2269
- l = e;
2270
- const d = a.domain ?? r, u = O(d) && !Ol(Kt(d)) || i, m = Tl(t ?? vo, u);
2271
- if (Se(m)) {
2272
- c = be(m);
2273
- const y = Dt(window.location.href), g = Dt(m);
2274
- y !== g && (a = { ...a, samesite: "None", secure: !0 }), !i && u && g !== Kt(d) && (l = !1, n.warn(qi(V, d, g)));
2275
- } else
2276
- l = !1;
2277
- }
2278
- return { sscEnabled: l, cookieOptions: a, finalDataServiceUrl: c };
2279
- }, xl = (n) => {
2280
- var u;
2281
- const { storage: e } = o.loadOptions.value;
2282
- let t = e == null ? void 0 : e.type;
2283
- O(t) && !Rl(t) && (n.warn(Vi(V, t, Rt)), t = Rt);
2284
- let s = (u = e == null ? void 0 : e.encryption) == null ? void 0 : u.version;
2285
- const r = s && Xe[s];
2286
- !w(s) && w(r) ? (n.warn(ji(V, s, Xe, ae)), s = ae) : w(s) && (s = ae);
2287
- const i = e == null ? void 0 : e.migrate, a = i && s === ae;
2288
- i === !0 && a !== i && n.warn(Ki(V, s, ae));
2289
- const { sscEnabled: l, finalDataServiceUrl: c, cookieOptions: d } = Bl(n);
2290
- $(() => {
2291
- o.storage.type.value = t, o.storage.cookie.value = d, o.serverCookies.isEnabledServerSideCookies.value = l, o.serverCookies.dataServiceUrl.value = c, o.storage.encryptionPluginName.value = Xe[s], o.storage.migrate.value = a;
2292
- });
2293
- }, Fl = (n) => {
2294
- var m, y, g, h;
2295
- const { provider: e, consentManagerPluginName: t, initialized: s, enabled: r, consentsData: i } = vs(o.loadOptions.value.consentManagement, n), a = o.loadOptions.value.preConsent;
2296
- let l = ((m = a == null ? void 0 : a.storage) == null ? void 0 : m.strategy) ?? ht;
2297
- const c = ["none", "session", "anonymousId"];
2298
- O(l) && !c.includes(l) && (l = ht, n.warn(io(V, (y = a == null ? void 0 : a.storage) == null ? void 0 : y.strategy, ht)));
2299
- let d = ((g = a == null ? void 0 : a.events) == null ? void 0 : g.delivery) ?? pt;
2300
- const u = ["immediate", "buffer"];
2301
- O(d) && !u.includes(d) && (d = pt, n.warn(oo(V, (h = a == null ? void 0 : a.events) == null ? void 0 : h.delivery, pt))), $(() => {
2302
- var p;
2303
- o.consents.activeConsentManagerPluginName.value = t, o.consents.initialized.value = s, o.consents.enabled.value = r, o.consents.data.value = i, o.consents.provider.value = e, o.consents.preConsent.value = {
2304
- // Only enable pre-consent if it is explicitly enabled and
2305
- // if it is not already initialized and
2306
- // if consent management is enabled
2307
- enabled: ((p = o.loadOptions.value.preConsent) == null ? void 0 : p.enabled) === !0 && s === !1 && r === !0,
2308
- storage: { strategy: l },
2309
- events: { delivery: d }
2310
- };
2311
- });
2312
- }, Hl = (n) => {
2313
- var s;
2314
- let e = o.consents.resolutionStrategy.value, t;
2315
- k(n.consentManagementMetadata) && (o.consents.provider.value && (e = ((s = n.consentManagementMetadata.providers.find((r) => r.provider === o.consents.provider.value)) == null ? void 0 : s.resolutionStrategy) ?? o.consents.resolutionStrategy.value), t = n.consentManagementMetadata), o.consents.provider.value === "custom" && (e = void 0), $(() => {
2316
- o.consents.metadata.value = S(t), o.consents.resolutionStrategy.value = e;
2317
- });
2318
- }, Gl = (n) => {
2319
- if (o.dataPlaneEvents.deliveryEnabled.value) {
2320
- const e = "XhrQueue";
2321
- let t = e;
2322
- o.loadOptions.value.useBeacon && (o.capabilities.isBeaconAvailable.value ? t = "BeaconQueue" : (t = e, n.warn(Xi(V)))), $(() => {
2323
- o.dataPlaneEvents.eventsQueuePluginName.value = t;
2324
- });
2325
- }
2326
- }, Vl = (n, e, t, s, r) => {
2327
- const i = new URLSearchParams({ p: Bn, v: we, build: Ue, writeKey: e, lockIntegrationsVersion: t.toString(), lockPluginsVersion: s.toString() });
2328
- let a = ts, l = i, c = "/sourceConfig/", d = "";
2329
- if (Se(n)) {
2330
- const u = new URL(n);
2331
- be(u.pathname).endsWith("/sourceConfig") || (u.pathname = `${be(u.pathname)}/sourceConfig/`), u.pathname = Cl(u.pathname), i.forEach((m, y) => {
2332
- u.searchParams.get(y) === null && u.searchParams.set(y, m);
2333
- }), a = u.origin, c = u.pathname, l = u.searchParams, d = u.hash;
2334
- } else
2335
- r.warn(so(V, n));
2336
- return `${a}${c}?${l}${d}`;
2337
- }, Es = (n, e, t, s, r, i, a) => {
2338
- let l;
2339
- if (i) {
2340
- if (!Se(i))
2341
- return a.error(Si(V, n, i)), null;
2342
- l = be(i);
2343
- } else if (l = t, o.context.app.value.installType === "cdn") {
2344
- const c = Ml();
2345
- c && (l = c.split("/").slice(0, -1).concat(e).join("/"));
2346
- }
2347
- return r && (l = l.replace(new RegExp(`/${Ht}/${Ue}/${e}$`), `/${s}/${Ue}/${e}`)), l;
2348
- }, jl = (n, e, t, s) => Es("integrations", Ft, Zn, n, e, t, s), Kl = (n, e, t, s) => Es("plugins", Yn, es, n, e, t, s);
2349
- class ql {
2350
- constructor(e, t, s) {
2351
- this.errorHandler = t, this.logger = s, this.httpClient = e, this.onError = this.onError.bind(this), this.processConfig = this.processConfig.bind(this);
2352
- }
2353
- attachEffects() {
2354
- J(() => {
2355
- this.logger.setMinLogLevel(o.lifecycle.logLevel.value);
2356
- });
2357
- }
2358
- /**
2359
- * A function to validate, construct and store loadOption, lifecycle, source and destination
2360
- * config related information in global state
2361
- */
2362
- init() {
2363
- const { logLevel: e, configUrl: t, lockIntegrationsVersion: s, lockPluginsVersion: r, destSDKBaseURL: i, pluginsSDKBaseURL: a, integrations: l } = o.loadOptions.value, c = jl(we, s, i, this.logger);
2364
- if (j(c))
2365
- return;
2366
- let d;
2367
- d = Kl(we, r, a, this.logger), d !== null && (this.attachEffects(), o.lifecycle.activeDataplaneUrl.value = be(o.lifecycle.dataPlaneUrl.value), xl(this.logger), Fl(this.logger), Gl(this.logger), $(() => {
2368
- o.lifecycle.integrationsCDNPath.value = c, o.lifecycle.pluginsCDNPath.value = d, e && (o.lifecycle.logLevel.value = e), o.lifecycle.sourceConfigUrl.value = Vl(t, o.lifecycle.writeKey.value, s, r, this.logger), o.metrics.metricsServiceUrl.value = `${o.lifecycle.activeDataplaneUrl.value}/${Eo}`, o.nativeDestinations.loadOnlyIntegrations.value = l;
2369
- }), this.getConfig());
2370
- }
2371
- /**
2372
- * Handle errors
2373
- */
2374
- onError(e, t) {
2375
- this.errorHandler.onError(e, V, t);
2376
- }
2377
- /**
2378
- * A callback function that is executed once we fetch the source config response.
2379
- * Use to construct and store information that are dependent on the sourceConfig.
2380
- */
2381
- processConfig(e, t) {
2382
- if (!O(e)) {
2383
- O(t) ? this.onError(t.error, sn) : this.onError(new Error(sn));
2384
- return;
2385
- }
2386
- let s;
2387
- try {
2388
- P(e) ? s = JSON.parse(e) : s = e;
2389
- } catch (i) {
2390
- this.onError(i, nn);
2391
- return;
2392
- }
2393
- if (!_l(s)) {
2394
- this.onError(new Error(nn));
2395
- return;
2396
- }
2397
- if (s.source.enabled === !1) {
2398
- this.logger.error(mi);
2399
- return;
2400
- }
2401
- Ul(s);
2402
- const r = s.source.destinations.length > 0 ? Al(s.source.destinations) : [];
2403
- $(() => {
2404
- o.source.value = { config: s.source.config, name: s.source.name, id: s.source.id, workspaceId: s.source.workspaceId }, o.nativeDestinations.configuredDestinations.value = r, o.plugins.pluginsToLoadFromConfig.value = o.loadOptions.value.plugins ?? [], Hl(s), o.lifecycle.status.value = "configured";
2405
- });
2406
- }
2407
- /**
2408
- * A function to fetch source config either from /sourceConfig endpoint
2409
- * or from getSourceConfig load option
2410
- * @returns
2411
- */
2412
- getConfig() {
2413
- const e = o.loadOptions.value.getSourceConfig;
2414
- if (e) {
2415
- if (!v(e)) {
2416
- this.logger.error(bi(V));
2417
- return;
2418
- }
2419
- const t = e();
2420
- t instanceof Promise ? t.then((s) => this.processConfig(s)).catch((s) => {
2421
- this.onError(s, "SourceConfig");
2422
- }) : this.processConfig(t);
2423
- } else
2424
- this.httpClient.getAsyncData({ url: o.lifecycle.sourceConfigUrl.value, options: { headers: { "Content-Type": void 0 } }, callback: this.processConfig });
2425
- }
2426
- }
2427
- const Ql = () => {
2428
- const n = /([A-Z]+[+-]\d+)/.exec((/* @__PURE__ */ new Date()).toString());
2429
- return n != null && n[1] ? n[1] : "NA";
2430
- }, ys = () => (document == null ? void 0 : document.referrer) || "$direct", Wl = () => {
2431
- const n = document.getElementsByTagName("link");
2432
- let e = "";
2433
- for (let t = 0; n[t]; t += 1) {
2434
- const s = n[t];
2435
- if (s.getAttribute("rel") === "canonical" && !e) {
2436
- e = s.getAttribute("href") ?? "";
2437
- break;
2438
- }
2439
- }
2440
- return e;
2441
- }, Xl = () => {
2442
- if (w(globalThis.navigator))
2443
- return null;
2444
- let { userAgent: n } = globalThis.navigator;
2445
- const { brave: e } = globalThis.navigator;
2446
- if (e && Object.getPrototypeOf(e).isBrave) {
2447
- const t = n.match(/(chrome)\/([\w.]+)/i);
2448
- t && (n = `${n} Brave/${t[2]}`);
2449
- }
2450
- return n;
2451
- }, zl = () => w(globalThis.navigator) ? null : globalThis.navigator.language ?? globalThis.navigator.browserLanguage, bs = () => {
2452
- const n = Wl();
2453
- let e = globalThis.location.pathname;
2454
- const { href: t } = globalThis.location;
2455
- let s = t;
2456
- const { search: r } = globalThis.location;
2457
- if (n)
2458
- try {
2459
- const c = new URL(n);
2460
- c.search === "" ? s = n + r : s = n, e = c.pathname;
2461
- } catch {
2462
- }
2463
- const i = kl(s), { title: a } = document, l = ys();
2464
- return { path: e, referrer: l, referring_domain: ms(l), search: r, title: a, url: i, tab_url: t };
2465
- }, Yl = `https://polyfill-fastly.io/v3/polyfill.min.js?version=3.111.0&features=${Object.keys(Ot).join("%2C")}`, Jl = 10 * 1e3, yn = "rudderstackPolyfill";
2466
- class Zl {
2467
- constructor(e, t, s) {
2468
- this.httpClient = e, this.errorHandler = t, this.logger = s, this.externalSrcLoader = new Hn(this.errorHandler, this.logger), this.onError = this.onError.bind(this), this.onReady = this.onReady.bind(this);
2469
- }
2470
- init() {
2471
- this.prepareBrowserCapabilities(), this.attachWindowListeners();
2472
- }
2473
- /**
2474
- * Detect supported capabilities and set values in state
2475
- */
2476
- // eslint-disable-next-line class-methods-use-this
2477
- detectBrowserCapabilities() {
2478
- $(() => {
2479
- o.capabilities.storage.isCookieStorageAvailable.value = Ee(F, H(F), this.logger), o.capabilities.storage.isLocalStorageAvailable.value = Ee(x, void 0, this.logger), o.capabilities.storage.isSessionStorageAvailable.value = Ee(G, void 0, this.logger), o.capabilities.isBeaconAvailable.value = za(), o.capabilities.isUaCHAvailable.value = pn(), o.capabilities.isCryptoAvailable.value = Xa(), o.capabilities.isIE11.value = Ya(), o.capabilities.isOnline.value = globalThis.navigator.onLine, o.context.userAgent.value = Xl(), o.context.locale.value = zl(), o.context.screen.value = mn(), o.context.timezone.value = Ql(), pn() && Ja((e) => {
2480
- o.context["ua-ch"].value = e;
2481
- }, o.loadOptions.value.uaChTrackLevel);
2482
- }), J(() => {
2483
- o.loadOptions.value.sendAdblockPage === !0 && o.lifecycle.sourceConfigUrl.value !== void 0 && Wa(this.httpClient);
2484
- });
2485
- }
2486
- /**
2487
- * Detect if polyfills are required and then load script from polyfill URL
2488
- */
2489
- prepareBrowserCapabilities() {
2490
- o.capabilities.isLegacyDOM.value = el();
2491
- const e = o.loadOptions.value.polyfillURL;
2492
- let t = Yl;
2493
- if (ye(e) && (Se(e) ? t = e : this.logger.warn(co(bt, e))), o.loadOptions.value.polyfillIfRequired && o.capabilities.isLegacyDOM.value && Se(t)) {
2494
- const r = t !== o.loadOptions.value.polyfillURL;
2495
- if (r) {
2496
- const i = `RS_polyfillCallback_${o.lifecycle.writeKey.value}`, a = () => {
2497
- this.onReady(), delete globalThis[i];
2498
- };
2499
- globalThis[i] = a, t = `${t}&callback=${i}`;
2500
- }
2501
- this.externalSrcLoader.loadJSFile({ url: t, id: yn, async: !0, timeout: Jl, callback: (i) => {
2502
- i ? r || this.onReady() : this.onError(new Error(ro(yn, t)));
2503
- } });
2504
- } else
2505
- this.onReady();
2506
- }
2507
- /**
2508
- * Attach listeners to window to observe event that update capabilities state values
2509
- */
2510
- attachWindowListeners() {
2511
- globalThis.addEventListener("offline", () => {
2512
- o.capabilities.isOnline.value = !1;
2513
- }), globalThis.addEventListener("online", () => {
2514
- o.capabilities.isOnline.value = !0;
2515
- }), globalThis.addEventListener("resize", Jr(() => {
2516
- o.context.screen.value = mn();
2517
- }, this));
2518
- }
2519
- /**
2520
- * Set the lifecycle status to next phase
2521
- */
2522
- // eslint-disable-next-line class-methods-use-this
2523
- onReady() {
2524
- this.detectBrowserCapabilities(), o.lifecycle.status.value = "browserCapabilitiesReady";
2525
- }
2526
- /**
2527
- * Handles error
2528
- * @param error The error object
2529
- */
2530
- onError(e) {
2531
- this.errorHandler.onError(e, bt);
2532
- }
2533
- }
2534
- const ec = "web", tc = ["integrations", "anonymousId", "originalTimestamp"], bn = ["library", "consentManagement", "userAgent", "ua-ch", "screen"], mt = ["id", "anonymous_id", "user_id", "sent_at", "timestamp", "received_at", "original_timestamp", "event", "event_text", "channel", "context_ip", "context_request_ip", "context_passed_ip", "group_id", "previous_id"], Ss = (n) => typeof n == "number" && !Number.isNaN(n), nc = (n, e) => e.toString().length >= n, _s = (n) => Ss(n) && n >= 0 && Number.isInteger(n), Sn = 10, _n = (n) => {
2535
- const e = Date.now();
2536
- return !n || e > n;
2537
- }, sc = () => Date.now(), rc = (n, e) => !n || !_s(n) || !nc(Sn, n) ? (e.warn(Zi(De, n, Sn)), !1) : !0, ic = (n) => {
2538
- const e = Date.now(), t = n || $e;
2539
- return {
2540
- id: e,
2541
- // set the current timestamp
2542
- expiresAt: e + t,
2543
- // set the expiry time of the session
2544
- timeout: t,
2545
- sessionStart: void 0,
2546
- autoTrack: !0
2547
- };
2548
- }, oc = (n, e) => ({ id: rc(n, e) ? n : sc(), sessionStart: void 0, manualTrack: !0 }), Ce = (n) => n === F || n === x || n === G || n === Q, kt = () => ot(), ac = (n) => {
2549
- const e = bs(), t = {};
2550
- return Object.keys(e).forEach((s) => {
2551
- t[s] = (n == null ? void 0 : n[s]) || e[s];
2552
- }), t.initial_referrer = (n == null ? void 0 : n.initial_referrer) || o.session.initialReferrer.value, t.initial_referring_domain = (n == null ? void 0 : n.initial_referring_domain) || o.session.initialReferringDomain.value, t;
2553
- }, lc = (n, e) => {
2554
- const t = (e == null ? void 0 : e.page) || {}, s = n, r = bs();
2555
- return Object.keys(r).forEach((i) => {
2556
- w(s[i]) && (s[i] = t[i] || r[i]);
2557
- }), w(s.initial_referrer) && (s.initial_referrer = t.initial_referrer || o.session.initialReferrer.value), w(s.initial_referring_domain) && (s.initial_referring_domain = t.initial_referring_domain || o.session.initialReferringDomain.value), s;
2558
- }, vt = (n, e, t) => {
2559
- k(n) && Object.keys(n).forEach((s) => {
2560
- (mt.includes(s) || mt.includes(s.toLowerCase())) && t.warn(Qi($n, s, e, mt));
2561
- });
2562
- }, cc = (n, e) => {
2563
- const { properties: t, traits: s, context: r } = n, { traits: i } = r;
2564
- vt(t, "properties", e), vt(s, "traits", e), vt(i, "context.traits", e);
2565
- }, uc = (n, e) => {
2566
- e.anonymousId && P(e.anonymousId) && (n.anonymousId = e.anonymousId), ie(e.integrations) && (n.integrations = e.integrations), e.originalTimestamp && P(e.originalTimestamp) && (n.originalTimestamp = e.originalTimestamp);
2567
- }, dc = (n, e, t) => {
2568
- let s = n;
2569
- return Object.keys(e).forEach((r) => {
2570
- if (!tc.includes(r) && !bn.includes(r))
2571
- if (r !== "context")
2572
- s = L(s, { [r]: e[r] });
2573
- else if (!w(e[r]) && k(e[r])) {
2574
- const i = {};
2575
- Object.keys(e[r]).forEach((a) => {
2576
- bn.includes(a) || (i[a] = e[r][a]);
2577
- }), s = L(s, { ...i });
2578
- } else
2579
- t.warn(Wi($n));
2580
- }), s;
2581
- }, fc = (n, e, t) => {
2582
- k(e) && (uc(n, e), n.context = dc(n.context, e, t));
2583
- }, gc = (n) => {
2584
- let e;
2585
- return o.loadOptions.value.useGlobalIntegrationsConfigInEvents ? e = o.consents.postConsent.value.integrations ?? o.nativeDestinations.loadOnlyIntegrations.value : n ? e = n : e = zn, S(e);
2586
- }, Oe = (n, e, t, s) => {
2587
- var a, l, c;
2588
- const r = { channel: ec, context: {
2589
- traits: S(o.session.userTraits.value),
2590
- sessionId: o.session.sessionInfo.value.id || void 0,
2591
- sessionStart: o.session.sessionInfo.value.sessionStart || void 0,
2592
- // Add 'consentManagement' only if consent management is enabled
2593
- ...o.consents.enabled.value && { consentManagement: { deniedConsentIds: S(o.consents.data.value.deniedConsentIds), allowedConsentIds: S(o.consents.data.value.allowedConsentIds), provider: o.consents.provider.value, resolutionStrategy: o.consents.resolutionStrategy.value } },
2594
- "ua-ch": o.context["ua-ch"].value,
2595
- app: o.context.app.value,
2596
- library: o.context.library.value,
2597
- userAgent: o.context.userAgent.value,
2598
- os: o.context.os.value,
2599
- locale: o.context.locale.value,
2600
- screen: o.context.screen.value,
2601
- campaign: Dl(globalThis.location.href),
2602
- page: ac(t),
2603
- timezone: o.context.timezone.value,
2604
- // Add auto tracking information
2605
- ...o.autoTrack.enabled.value && { autoTrack: { ...o.autoTrack.pageLifecycle.enabled.value && { page: { visitId: o.autoTrack.pageLifecycle.visitId.value } } } }
2606
- }, originalTimestamp: Pr(), messageId: ot(), userId: n.userId || o.session.userId.value };
2607
- Ce((a = o.storage.entries.value.anonymousId) == null ? void 0 : a.type) ? r.anonymousId = o.session.anonymousId.value : r.anonymousId = kt(), o.storage.trulyAnonymousTracking.value && (r.context.trulyAnonymousTracking = !0), n.type === "identify" && (r.context.traits = ((l = o.storage.entries.value.userTraits) == null ? void 0 : l.type) !== ue ? S(o.session.userTraits.value) : n.context.traits), n.type === "group" && ((n.groupId || o.session.groupId.value) && (r.groupId = n.groupId || o.session.groupId.value), (n.traits || o.session.groupTraits.value) && (r.traits = ((c = o.storage.entries.value.groupTraits) == null ? void 0 : c.type) !== ue ? S(o.session.groupTraits.value) : n.traits));
2608
- const i = L(n, r);
2609
- return i.event === void 0 && (i.event = null), i.properties === void 0 && (i.properties = null), fc(i, e, s), cc(i, s), i.integrations = gc(i.integrations), i;
2610
- };
2611
- class hc {
2612
- constructor(e) {
2613
- this.logger = e;
2614
- }
2615
- /**
2616
- * Generate a 'page' event based on the user-input fields
2617
- * @param category Page's category
2618
- * @param name Page name
2619
- * @param properties Page properties
2620
- * @param options API options
2621
- */
2622
- generatePageEvent(e, t, s, r) {
2623
- let i = s ?? {};
2624
- return i = lc(i, r), Oe({ properties: i, name: t, category: e, type: "page" }, r, i, this.logger);
2625
- }
2626
- /**
2627
- * Generate a 'track' event based on the user-input fields
2628
- * @param event The event name
2629
- * @param properties Event properties
2630
- * @param options API options
2631
- */
2632
- generateTrackEvent(e, t, s) {
2633
- return Oe({ properties: t, event: e, type: "track" }, s, void 0, this.logger);
2634
- }
2635
- /**
2636
- * Generate an 'identify' event based on the user-input fields
2637
- * @param userId New user ID
2638
- * @param traits new traits
2639
- * @param options API options
2640
- */
2641
- generateIdentifyEvent(e, t, s) {
2642
- return Oe({ userId: e, type: "identify", context: { traits: t } }, s, void 0, this.logger);
2643
- }
2644
- /**
2645
- * Generate an 'alias' event based on the user-input fields
2646
- * @param to New user ID
2647
- * @param from Old user ID
2648
- * @param options API options
2649
- */
2650
- generateAliasEvent(e, t, s) {
2651
- const i = Oe({ previousId: t, type: "alias" }, s, void 0, this.logger);
2652
- return i.userId = e ?? i.userId, i;
2653
- }
2654
- /**
2655
- * Generate a 'group' event based on the user-input fields
2656
- * @param groupId New group ID
2657
- * @param traits new group traits
2658
- * @param options API options
2659
- */
2660
- generateGroupEvent(e, t, s) {
2661
- const r = { type: "group" };
2662
- return e && (r.groupId = e), t && (r.traits = t), Oe(r, s, void 0, this.logger);
2663
- }
2664
- /**
2665
- * Generates a new RudderEvent object based on the user-input fields
2666
- * @param event API event parameters object
2667
- * @returns A RudderEvent object
2668
- */
2669
- create(e) {
2670
- let t;
2671
- switch (e.type) {
2672
- case "page":
2673
- t = this.generatePageEvent(e.category, e.name, e.properties, e.options);
2674
- break;
2675
- case "track":
2676
- t = this.generateTrackEvent(e.name, e.properties, e.options);
2677
- break;
2678
- case "identify":
2679
- t = this.generateIdentifyEvent(e.userId, e.traits, e.options);
2680
- break;
2681
- case "alias":
2682
- t = this.generateAliasEvent(e.to, e.from, e.options);
2683
- break;
2684
- case "group":
2685
- default:
2686
- t = this.generateGroupEvent(e.groupId, e.traits, e.options);
2687
- break;
2688
- }
2689
- return t;
2690
- }
2691
- }
2692
- class pc {
2693
- /**
2694
- *
2695
- * @param eventRepository Event repository instance
2696
- * @param userSessionManager UserSession Manager instance
2697
- * @param errorHandler Error handler object
2698
- * @param logger Logger object
2699
- */
2700
- constructor(e, t, s, r) {
2701
- this.eventRepository = e, this.userSessionManager = t, this.errorHandler = s, this.logger = r, this.eventFactory = new hc(this.logger);
2702
- }
2703
- /**
2704
- * Initializes the event manager
2705
- */
2706
- init() {
2707
- this.eventRepository.init();
2708
- }
2709
- resume() {
2710
- this.eventRepository.resume();
2711
- }
2712
- /**
2713
- * Consumes a new incoming event
2714
- * @param event Incoming event data
2715
- */
2716
- addEvent(e) {
2717
- this.userSessionManager.refreshSession();
2718
- const t = this.eventFactory.create(e);
2719
- this.eventRepository.enqueue(t, e.callback);
2720
- }
2721
- }
2722
- class mc {
2723
- constructor(e, t, s, r, i) {
2724
- this.storeManager = t, this.pluginsManager = e, this.logger = i, this.errorHandler = r, this.httpClient = s, this.onError = this.onError.bind(this), this.serverSideCookieDebounceFuncs = {};
2725
- }
2726
- /**
2727
- * Initialize User session with values from storage
2728
- */
2729
- init() {
2730
- this.syncStorageDataToState(), this.registerEffects();
2731
- }
2732
- syncStorageDataToState() {
2733
- this.migrateStorageIfNeeded(), this.migrateDataFromPreviousStorage(), this.setUserId(this.getUserId()), this.setUserTraits(this.getUserTraits()), this.setGroupId(this.getGroupId()), this.setGroupTraits(this.getGroupTraits());
2734
- const { externalAnonymousIdCookieName: e, anonymousIdOptions: t } = o.loadOptions.value;
2735
- let s;
2736
- ye(e) && typeof e == "string" && (s = this.getExternalAnonymousIdByCookieName(e)), this.setAnonymousId(s ?? this.getAnonymousId(t)), this.setAuthToken(this.getAuthToken()), this.setInitialReferrerInfo(), this.configureSessionTracking();
2737
- }
2738
- configureSessionTracking() {
2739
- let e = this.getSessionInfo();
2740
- if (this.isPersistenceEnabledForStorageEntry("sessionInfo")) {
2741
- const t = this.getConfiguredSessionTrackingInfo(), s = e ?? _o;
2742
- e = {
2743
- ...s,
2744
- ...t,
2745
- // If manualTrack is set to true in the storage, then autoTrack should be false
2746
- autoTrack: t.autoTrack && s.manualTrack !== !0
2747
- }, !e.autoTrack && e.manualTrack !== !0 && (e = R.sessionInfo);
2748
- } else
2749
- e = R.sessionInfo;
2750
- o.session.sessionInfo.value = e, o.session.sessionInfo.value.autoTrack && this.startOrRenewAutoTracking(o.session.sessionInfo.value);
2751
- }
2752
- setInitialReferrerInfo() {
2753
- const e = this.getInitialReferrer(), t = this.getInitialReferringDomain();
2754
- if (e && t)
2755
- this.setInitialReferrer(e), this.setInitialReferringDomain(t);
2756
- else {
2757
- const s = e || ys();
2758
- this.setInitialReferrer(s), this.setInitialReferringDomain(ms(s));
2759
- }
2760
- }
2761
- isPersistenceEnabledForStorageEntry(e) {
2762
- var t;
2763
- return Ce((t = o.storage.entries.value[e]) == null ? void 0 : t.type);
2764
- }
2765
- migrateDataFromPreviousStorage() {
2766
- const e = o.storage.entries.value, t = [F, x, G];
2767
- Object.keys(e).forEach((s) => {
2768
- var l, c;
2769
- const r = s, i = (l = e[r]) == null ? void 0 : l.type, a = (c = this.storeManager) == null ? void 0 : c.getStore(pe[i]);
2770
- a && t.forEach((d) => {
2771
- var m;
2772
- const u = (m = this.storeManager) == null ? void 0 : m.getStore(pe[d]);
2773
- if (u && d !== i) {
2774
- const y = u.get(he[r]);
2775
- hr(y) && a.set(he[r], y), u.remove(he[r]);
2776
- }
2777
- });
2778
- });
2779
- }
2780
- migrateStorageIfNeeded() {
2781
- if (!o.storage.migrate.value)
2782
- return;
2783
- const e = [ls, cs, us], t = [];
2784
- e.forEach((s) => {
2785
- var i;
2786
- const r = (i = this.storeManager) == null ? void 0 : i.getStore(s);
2787
- r && t.push(r);
2788
- }), Object.keys(he).forEach((s) => {
2789
- const r = he[s];
2790
- t.forEach((i) => {
2791
- var l;
2792
- const a = (l = this.pluginsManager) == null ? void 0 : l.invokeSingle("storage.migrate", r, i.engine, this.errorHandler, this.logger);
2793
- K(a) || i.set(r, a);
2794
- });
2795
- });
2796
- }
2797
- getConfiguredSessionTrackingInfo() {
2798
- var r, i;
2799
- let e = ((r = o.loadOptions.value.sessions) == null ? void 0 : r.autoTrack) !== !1;
2800
- if (!e)
2801
- return { autoTrack: e };
2802
- let t;
2803
- const s = (i = o.loadOptions.value.sessions) == null ? void 0 : i.timeout;
2804
- return _s(s) ? t = s : (this.logger.warn(zi(De, s, $e)), t = $e), t === 0 && (this.logger.warn(Yi(De)), e = !1), t > 0 && t < Zt && this.logger.warn(Ji(De, t, Zt)), { timeout: t, autoTrack: e };
2805
- }
2806
- /**
2807
- * Handles error
2808
- * @param error The error object
2809
- */
2810
- onError(e, t) {
2811
- this.errorHandler.onError(e, De, t);
2812
- }
2813
- /**
2814
- * A function to encrypt the cookie value and return the encrypted data
2815
- * @param cookiesData
2816
- * @param store
2817
- * @returns
2818
- */
2819
- getEncryptedCookieData(e, t) {
2820
- const s = [];
2821
- return e.forEach((r) => {
2822
- const i = t == null ? void 0 : t.encrypt(W(r.value, !1, [], this.logger));
2823
- ye(i) && s.push({ name: r.name, value: i });
2824
- }), s;
2825
- }
2826
- /**
2827
- * A function that makes request to data service to set the cookie
2828
- * @param encryptedCookieData
2829
- * @param callback
2830
- */
2831
- makeRequestToSetCookie(e, t) {
2832
- var s, r, i, a, l, c, d, u;
2833
- (u = this.httpClient) == null || u.getAsyncData({ url: o.serverCookies.dataServiceUrl.value, options: { method: "POST", data: W({ reqType: "setCookies", workspaceId: (s = o.source.value) == null ? void 0 : s.workspaceId, data: { options: { maxAge: (r = o.storage.cookie.value) == null ? void 0 : r.maxage, path: (i = o.storage.cookie.value) == null ? void 0 : i.path, domain: (a = o.storage.cookie.value) == null ? void 0 : a.domain, sameSite: (l = o.storage.cookie.value) == null ? void 0 : l.samesite, secure: (c = o.storage.cookie.value) == null ? void 0 : c.secure, expires: (d = o.storage.cookie.value) == null ? void 0 : d.expires }, cookies: e } }), sendRawData: !0, withCredentials: !0 }, isRawResponse: !0, callback: t });
2834
- }
2835
- /**
2836
- * A function to make an external request to set the cookie from server side
2837
- * @param key cookie name
2838
- * @param value encrypted cookie value
2839
- */
2840
- setServerSideCookies(e, t, s) {
2841
- try {
2842
- const r = this.getEncryptedCookieData(e, s);
2843
- r.length > 0 && this.makeRequestToSetCookie(r, (i, a) => {
2844
- var l, c;
2845
- ((l = a == null ? void 0 : a.xhr) == null ? void 0 : l.status) === 200 ? e.forEach((d) => {
2846
- const u = s == null ? void 0 : s.get(d.name), m = W(d.value, !1, []);
2847
- W(u, !1, []) !== m && (this.logger.error(Hi(d.name)), t && t(d.name, d.value));
2848
- }) : (this.logger.error(Fi((c = a == null ? void 0 : a.xhr) == null ? void 0 : c.status)), e.forEach((d) => {
2849
- t && t(d.name, d.value);
2850
- }));
2851
- });
2852
- } catch (r) {
2853
- this.onError(r, Gi), e.forEach((i) => {
2854
- t && t(i.name, i.value);
2855
- });
2856
- }
2857
- }
2858
- /**
2859
- * A function to sync values in storage
2860
- * @param sessionKey
2861
- * @param value
2862
- */
2863
- syncValueToStorage(e, t) {
2864
- var i, a, l;
2865
- const s = o.storage.entries.value, r = (i = s[e]) == null ? void 0 : i.type;
2866
- if (Ce(r)) {
2867
- const c = (a = this.storeManager) == null ? void 0 : a.getStore(pe[r]), d = (l = s[e]) == null ? void 0 : l.key;
2868
- t && (P(t) || ie(t)) ? o.serverCookies.isEnabledServerSideCookies.value && r === F ? (this.serverSideCookieDebounceFuncs[e] && globalThis.clearTimeout(this.serverSideCookieDebounceFuncs[e]), this.serverSideCookieDebounceFuncs[e] = globalThis.setTimeout(() => {
2869
- this.setServerSideCookies([{ name: d, value: t }], (u, m) => {
2870
- c == null || c.set(u, m);
2871
- }, c);
2872
- }, So)) : c == null || c.set(d, t) : c == null || c.remove(d);
2873
- }
2874
- }
2875
- /**
2876
- * Function to update storage whenever state value changes
2877
- */
2878
- registerEffects() {
2879
- ds.forEach((e) => {
2880
- J(() => {
2881
- this.syncValueToStorage(e, o.session[e].value);
2882
- });
2883
- });
2884
- }
2885
- /**
2886
- * Sets anonymous id in the following precedence:
2887
- *
2888
- * 1. anonymousId: Id directly provided to the function.
2889
- * 2. rudderAmpLinkerParam: value generated from linker query parm (rudderstack)
2890
- * using parseLinker util.
2891
- * 3. generateUUID: A new unique id is generated and assigned.
2892
- */
2893
- setAnonymousId(e, t) {
2894
- var r;
2895
- let s = e;
2896
- (!P(e) || !s) && (s = void 0), this.isPersistenceEnabledForStorageEntry("anonymousId") ? (!s && t && (s = (r = this.pluginsManager) == null ? void 0 : r.invokeSingle("userSession.anonymousIdGoogleLinker", t)), s = s || kt()) : s = R.anonymousId, o.session.anonymousId.value = s;
2897
- }
2898
- /**
2899
- * Fetches anonymousId
2900
- * @param options option to fetch it from external source
2901
- * @returns anonymousId
2902
- */
2903
- getAnonymousId(e) {
2904
- var s, r;
2905
- const t = (s = o.storage.entries.value.anonymousId) == null ? void 0 : s.type;
2906
- if (Ce(t)) {
2907
- let i = this.getEntryValue("anonymousId");
2908
- !i && e && (i = (r = this.pluginsManager) == null ? void 0 : r.invokeSingle("storage.getAnonymousId", H, e)), o.session.anonymousId.value = i || kt();
2909
- }
2910
- return o.session.anonymousId.value;
2911
- }
2912
- getEntryValue(e) {
2913
- var r, i, a;
2914
- const t = o.storage.entries.value, s = (r = t[e]) == null ? void 0 : r.type;
2915
- if (Ce(s)) {
2916
- const l = (i = this.storeManager) == null ? void 0 : i.getStore(pe[s]), c = (a = t[e]) == null ? void 0 : a.key;
2917
- return (l == null ? void 0 : l.get(c)) ?? null;
2918
- }
2919
- return null;
2920
- }
2921
- getExternalAnonymousIdByCookieName(e) {
2922
- const t = H(F);
2923
- return t != null && t.isEnabled ? t.getItem(e) ?? null : null;
2924
- }
2925
- /**
2926
- * Fetches User Id
2927
- * @returns
2928
- */
2929
- getUserId() {
2930
- return this.getEntryValue("userId");
2931
- }
2932
- /**
2933
- * Fetches User Traits
2934
- * @returns
2935
- */
2936
- getUserTraits() {
2937
- return this.getEntryValue("userTraits");
2938
- }
2939
- /**
2940
- * Fetches Group Id
2941
- * @returns
2942
- */
2943
- getGroupId() {
2944
- return this.getEntryValue("groupId");
2945
- }
2946
- /**
2947
- * Fetches Group Traits
2948
- * @returns
2949
- */
2950
- getGroupTraits() {
2951
- return this.getEntryValue("groupTraits");
2952
- }
2953
- /**
2954
- * Fetches Initial Referrer
2955
- * @returns
2956
- */
2957
- getInitialReferrer() {
2958
- return this.getEntryValue("initialReferrer");
2959
- }
2960
- /**
2961
- * Fetches Initial Referring domain
2962
- * @returns
2963
- */
2964
- getInitialReferringDomain() {
2965
- return this.getEntryValue("initialReferringDomain");
2966
- }
2967
- /**
2968
- * Fetches session tracking information from storage
2969
- * @returns
2970
- */
2971
- getSessionInfo() {
2972
- return this.getEntryValue("sessionInfo");
2973
- }
2974
- /**
2975
- * Fetches auth token from storage
2976
- * @returns
2977
- */
2978
- getAuthToken() {
2979
- return this.getEntryValue("authToken");
2980
- }
2981
- /**
2982
- * If session is active it returns the sessionId
2983
- * @returns
2984
- */
2985
- getSessionId() {
2986
- const e = this.getSessionInfo() ?? R.sessionInfo;
2987
- return e.autoTrack && !_n(e.expiresAt) || e.manualTrack ? e.id ?? null : null;
2988
- }
2989
- /**
2990
- * A function to keep the session information up to date in the state
2991
- * before using it for building event payloads.
2992
- */
2993
- refreshSession() {
2994
- let e = this.getSessionInfo() ?? R.sessionInfo;
2995
- (e.autoTrack || e.manualTrack) && (e.autoTrack && (this.startOrRenewAutoTracking(e), e = o.session.sessionInfo.value), e.sessionStart === void 0 ? e = { ...e, sessionStart: !0 } : e.sessionStart && (e = { ...e, sessionStart: !1 })), o.session.sessionInfo.value = e, o.lifecycle.status.value !== "readyExecuted" && this.syncValueToStorage("sessionInfo", e);
2996
- }
2997
- /**
2998
- * Reset state values
2999
- * @param resetAnonymousId
3000
- * @param noNewSessionStart
3001
- * @returns
3002
- */
3003
- reset(e, t) {
3004
- const { session: s } = o, { manualTrack: r, autoTrack: i } = s.sessionInfo.value;
3005
- $(() => {
3006
- s.userId.value = R.userId, s.userTraits.value = R.userTraits, s.groupId.value = R.groupId, s.groupTraits.value = R.groupTraits, s.authToken.value = R.authToken, e === !0 && this.setAnonymousId(), !t && (i ? (s.sessionInfo.value = R.sessionInfo, this.startOrRenewAutoTracking(s.sessionInfo.value)) : r && this.startManualTrackingInternal());
3007
- });
3008
- }
3009
- /**
3010
- * Set user Id
3011
- * @param userId
3012
- */
3013
- setUserId(e) {
3014
- o.session.userId.value = this.isPersistenceEnabledForStorageEntry("userId") && e ? e : R.userId;
3015
- }
3016
- /**
3017
- * Set user traits
3018
- * @param traits
3019
- */
3020
- setUserTraits(e) {
3021
- o.session.userTraits.value = this.isPersistenceEnabledForStorageEntry("userTraits") && k(e) ? L(o.session.userTraits.value ?? R.userTraits, e) : R.userTraits;
3022
- }
3023
- /**
3024
- * Set group Id
3025
- * @param groupId
3026
- */
3027
- setGroupId(e) {
3028
- o.session.groupId.value = this.isPersistenceEnabledForStorageEntry("groupId") && e ? e : R.groupId;
3029
- }
3030
- /**
3031
- * Set group traits
3032
- * @param traits
3033
- */
3034
- setGroupTraits(e) {
3035
- o.session.groupTraits.value = this.isPersistenceEnabledForStorageEntry("groupTraits") && k(e) ? L(o.session.groupTraits.value ?? R.groupTraits, e) : R.groupTraits;
3036
- }
3037
- /**
3038
- * Set initial referrer
3039
- * @param referrer
3040
- */
3041
- setInitialReferrer(e) {
3042
- o.session.initialReferrer.value = this.isPersistenceEnabledForStorageEntry("initialReferrer") && e ? e : R.initialReferrer;
3043
- }
3044
- /**
3045
- * Set initial referring domain
3046
- * @param {String} referringDomain
3047
- */
3048
- setInitialReferringDomain(e) {
3049
- o.session.initialReferringDomain.value = this.isPersistenceEnabledForStorageEntry("initialReferringDomain") && e ? e : R.initialReferringDomain;
3050
- }
3051
- /**
3052
- * A function to check for existing session details and depending on that create a new session
3053
- */
3054
- startOrRenewAutoTracking(e) {
3055
- if (_n(e.expiresAt))
3056
- o.session.sessionInfo.value = ic(e.timeout);
3057
- else {
3058
- const t = Date.now(), s = e.timeout;
3059
- o.session.sessionInfo.value = L(e, {
3060
- expiresAt: t + s
3061
- // set the expiry time of the session
3062
- });
3063
- }
3064
- }
3065
- /**
3066
- * A function method to start a manual session
3067
- * @param {number} id session identifier
3068
- * @returns
3069
- */
3070
- start(e) {
3071
- o.session.sessionInfo.value = oc(e, this.logger);
3072
- }
3073
- /**
3074
- * An internal function to start manual session
3075
- */
3076
- startManualTrackingInternal() {
3077
- this.start(Date.now());
3078
- }
3079
- /**
3080
- * A public method to end an ongoing session.
3081
- */
3082
- end() {
3083
- o.session.sessionInfo.value = R.sessionInfo;
3084
- }
3085
- /**
3086
- * Set auth token
3087
- * @param userId
3088
- */
3089
- setAuthToken(e) {
3090
- o.session.authToken.value = this.isPersistenceEnabledForStorageEntry("authToken") && e ? e : R.authToken;
3091
- }
3092
- }
3093
- const vc = ["BeaconQueue", "CustomConsentManager", "DeviceModeDestinations", "DeviceModeTransformation", "ExternalAnonymousId", "GoogleLinker", "IubendaConsentManager", "KetchConsentManager", "NativeDestinationQueue", "OneTrustConsentManager", "StorageEncryption", "StorageEncryptionLegacy", "StorageMigrator", "XhrQueue"], Ec = (n, e) => {
3094
- var a;
3095
- const t = S(e);
3096
- return P(t.setCookieDomain) || (t.setCookieDomain = void 0), ["Strict", "Lax", "None"].includes(t.sameSiteCookie) || (t.sameSiteCookie = void 0), t.secureCookie = q(t.secureCookie, n.secureCookie), t.sameDomainCookiesOnly = q(t.sameDomainCookiesOnly, n.sameDomainCookiesOnly), ["none", "default", "full"].includes(t.uaChTrackLevel) || (t.uaChTrackLevel = void 0), t.integrations = ee(t.integrations), Array.isArray(t.plugins) || (t.plugins = vc), t.useGlobalIntegrationsConfigInEvents = q(t.useGlobalIntegrationsConfigInEvents, n.useGlobalIntegrationsConfigInEvents), t.bufferDataPlaneEventsUntilReady = q(t.bufferDataPlaneEventsUntilReady, n.bufferDataPlaneEventsUntilReady), t.sendAdblockPage = q(t.sendAdblockPage, n.sendAdblockPage), t.useServerSideCookies = q(t.useServerSideCookies, n.useServerSideCookies), P(t.dataServiceEndpoint) || (t.dataServiceEndpoint = void 0), t.sendAdblockPageOptions = ee(t.sendAdblockPageOptions), t.loadIntegration = q(t.loadIntegration, n.loadIntegration), ie(t.storage) ? (t.storage.migrate = q(t.storage.migrate, (a = n.storage) == null ? void 0 : a.migrate), t.storage.cookie = ee(t.storage.cookie), t.storage.encryption = ee(t.storage.encryption), t.storage = tt(t.storage)) : t.storage = void 0, t.destinationsQueueOptions = ee(t.destinationsQueueOptions), t.queueOptions = ee(t.queueOptions), t.lockIntegrationsVersion = q(t.lockIntegrationsVersion, n.lockIntegrationsVersion), t.lockPluginsVersion = q(t.lockPluginsVersion, n.lockPluginsVersion), Ss(t.dataPlaneEventsBufferTimeout) || (t.dataPlaneEventsBufferTimeout = void 0), t.beaconQueueOptions = ee(t.beaconQueueOptions), t.preConsent = ee(t.preConsent), L(n, tt(t));
3097
- }, Rn = "dataplaneEventsQueue", In = "destinationsEventsQueue", yc = "transformEvent", bc = (n, e) => Object.keys(n).filter((t) => n[t] !== !0 || !e[t]).reduce((t, s) => {
3098
- const r = S(t);
3099
- return r[s] = n[s], r;
3100
- }, {}), Sc = (n, e) => {
3101
- const t = S(n), s = e.nativeDestinations.integrationsConfig.value, r = bc(n.integrations, s);
3102
- return t.integrations = L(s, r), t;
3103
- }, _c = (n) => {
3104
- var e, t, s;
3105
- return n.consents.preConsent.value.enabled && ((e = n.consents.preConsent.value.events) == null ? void 0 : e.delivery) === "buffer" && (((t = n.consents.preConsent.value.storage) == null ? void 0 : t.strategy) === "session" || ((s = n.consents.preConsent.value.storage) == null ? void 0 : s.strategy) === "none");
3106
- }, et = (n, e, t, s) => {
3107
- if (O(n))
3108
- if (v(n))
3109
- try {
3110
- n(...e);
3111
- } catch (r) {
3112
- s.error(no(t), r);
3113
- }
3114
- else
3115
- s.error(Xn(t));
3116
- };
3117
- class Rc {
3118
- /**
3119
- *
3120
- * @param pluginsManager Plugins manager instance
3121
- * @param storeManager Store Manager instance
3122
- * @param errorHandler Error handler object
3123
- * @param logger Logger object
3124
- */
3125
- constructor(e, t, s, r, i) {
3126
- this.pluginsManager = e, this.errorHandler = r, this.httpClient = s, this.logger = i, this.storeManager = t;
3127
- }
3128
- /**
3129
- * Initializes the event repository
3130
- */
3131
- init() {
3132
- this.dataplaneEventsQueue = this.pluginsManager.invokeSingle(`${Rn}.init`, o, this.httpClient, this.storeManager, this.errorHandler, this.logger), this.dmtEventsQueue = this.pluginsManager.invokeSingle(`${yc}.init`, o, this.pluginsManager, this.httpClient, this.storeManager, this.errorHandler, this.logger), this.destinationsEventsQueue = this.pluginsManager.invokeSingle(`${In}.init`, o, this.pluginsManager, this.storeManager, this.dmtEventsQueue, this.errorHandler, this.logger), J(() => {
3133
- var s, r;
3134
- o.nativeDestinations.clientDestinationsReady.value === !0 && ((s = this.destinationsEventsQueue) == null || s.start(), (r = this.dmtEventsQueue) == null || r.start());
3135
- });
3136
- const e = _c(o);
3137
- let t;
3138
- J(() => {
3139
- var i, a;
3140
- const s = o.loadOptions.value.bufferDataPlaneEventsUntilReady === !0 && o.nativeDestinations.clientDestinationsReady.value === !1;
3141
- (o.nativeDestinations.activeDestinations.value.some((l) => Sa(l)) === !1 || s === !1) && !e && ((i = this.dataplaneEventsQueue) == null ? void 0 : i.scheduleTimeoutActive) !== !0 && (globalThis.clearTimeout(t), (a = this.dataplaneEventsQueue) == null || a.start());
3142
- }), o.loadOptions.value.bufferDataPlaneEventsUntilReady === !0 && (t = globalThis.setTimeout(() => {
3143
- var s, r;
3144
- ((s = this.dataplaneEventsQueue) == null ? void 0 : s.scheduleTimeoutActive) !== !0 && ((r = this.dataplaneEventsQueue) == null || r.start());
3145
- }, o.loadOptions.value.dataPlaneEventsBufferTimeout));
3146
- }
3147
- resume() {
3148
- var e, t, s, r;
3149
- ((e = this.dataplaneEventsQueue) == null ? void 0 : e.scheduleTimeoutActive) !== !0 && (o.consents.postConsent.value.discardPreConsentEvents && ((t = this.dataplaneEventsQueue) == null || t.clear(), (s = this.destinationsEventsQueue) == null || s.clear()), (r = this.dataplaneEventsQueue) == null || r.start());
3150
- }
3151
- /**
3152
- * Enqueues the event for processing
3153
- * @param event RudderEvent object
3154
- * @param callback API callback function
3155
- */
3156
- enqueue(e, t) {
3157
- const s = Sc(e, o);
3158
- this.pluginsManager.invokeSingle(`${Rn}.enqueue`, o, this.dataplaneEventsQueue, s, this.errorHandler, this.logger);
3159
- const r = S(e);
3160
- this.pluginsManager.invokeSingle(`${In}.enqueue`, o, this.destinationsEventsQueue, r, this.errorHandler, this.logger);
3161
- const i = `${e.type.charAt(0).toUpperCase()}${e.type.slice(1)}${Ut}`;
3162
- et(t, [s], i, this.logger);
3163
- }
3164
- }
3165
- const Tn = (n) => {
3166
- const e = new CustomEvent(n, { detail: { analyticsInstance: globalThis.rudderanalytics }, bubbles: !0, cancelable: !0, composed: !0 });
3167
- globalThis.document.dispatchEvent(e);
3168
- }, Ic = (n) => P(n) && n.trim().length > 0, Tc = (n) => Se(n);
3169
- class On {
3170
- /**
3171
- * Initialize services and components or use default ones if singletons
3172
- */
3173
- constructor() {
3174
- this.preloadBuffer = new di(), this.initialized = !1, this.errorHandler = va, this.logger = X, this.externalSrcLoader = new Hn(this.errorHandler, this.logger), this.httpClient = rs, this.httpClient.init(this.errorHandler), this.capabilitiesManager = new Zl(this.httpClient, this.errorHandler, this.logger);
3175
- }
3176
- /**
3177
- * Start application lifecycle if not already started
3178
- */
3179
- load(e, t, s = {}) {
3180
- if (!o.lifecycle.status.value) {
3181
- if (!Ic(e)) {
3182
- this.logger.error(Li(ut, e));
3183
- return;
3184
- }
3185
- if (!Tc(t)) {
3186
- this.logger.error(wi(ut, t));
3187
- return;
3188
- }
3189
- $(() => {
3190
- o.lifecycle.writeKey.value = S(e), o.lifecycle.dataPlaneUrl.value = S(t), o.loadOptions.value = Ec(o.loadOptions.value, s), o.lifecycle.status.value = "mounted";
3191
- }), this.logger.setMinLogLevel(o.loadOptions.value.logLevel ?? Qn), Me("state", o, e), this.startLifecycle();
3192
- }
3193
- }
3194
- // Start lifecycle methods
3195
- /**
3196
- * Orchestrate the lifecycle of the application phases/status
3197
- */
3198
- startLifecycle() {
3199
- J(() => {
3200
- try {
3201
- switch (o.lifecycle.status.value) {
3202
- case "mounted":
3203
- this.onMounted();
3204
- break;
3205
- case "browserCapabilitiesReady":
3206
- this.onBrowserCapabilitiesReady();
3207
- break;
3208
- case "configured":
3209
- this.onConfigured();
3210
- break;
3211
- case "pluginsLoading":
3212
- break;
3213
- case "pluginsReady":
3214
- this.onPluginsReady();
3215
- break;
3216
- case "initialized":
3217
- this.onInitialized();
3218
- break;
3219
- case "loaded":
3220
- this.onLoaded();
3221
- break;
3222
- case "destinationsLoading":
3223
- break;
3224
- case "destinationsReady":
3225
- this.onDestinationsReady();
3226
- break;
3227
- case "ready":
3228
- this.onReady();
3229
- break;
3230
- case "readyExecuted":
3231
- default:
3232
- break;
3233
- }
3234
- } catch (e) {
3235
- this.errorHandler.onError(Be(e, "Failed to load the SDK"), ut);
3236
- }
3237
- });
3238
- }
3239
- onBrowserCapabilitiesReady() {
3240
- ni(this), this.prepareInternalServices(), this.loadConfig();
3241
- }
3242
- onLoaded() {
3243
- this.processBufferedEvents(), o.consents.preConsent.value.enabled === !0 ? o.lifecycle.status.value = "ready" : this.loadDestinations();
3244
- }
3245
- /**
3246
- * Load browser polyfill if required
3247
- */
3248
- onMounted() {
3249
- this.capabilitiesManager.init();
3250
- }
3251
- /**
3252
- * Enqueue in SDK preload buffer events, used from preloadBuffer component
3253
- */
3254
- enqueuePreloadBufferEvents(e) {
3255
- Array.isArray(e) && e.forEach((t) => this.preloadBuffer.enqueue(S(t)));
3256
- }
3257
- /**
3258
- * Process the buffer preloaded events by passing their arguments to the respective facade methods
3259
- */
3260
- processDataInPreloadBuffer() {
3261
- for (; this.preloadBuffer.size() > 0; ) {
3262
- const e = this.preloadBuffer.dequeue();
3263
- e && si([...e], this);
3264
- }
3265
- }
3266
- prepareInternalServices() {
3267
- this.pluginsManager = new Ca(ya, this.errorHandler, this.logger), this.storeManager = new Sl(this.pluginsManager, this.errorHandler, this.logger), this.configManager = new ql(this.httpClient, this.errorHandler, this.logger), this.userSessionManager = new mc(this.pluginsManager, this.storeManager, this.httpClient, this.errorHandler, this.logger), this.eventRepository = new Rc(this.pluginsManager, this.storeManager, this.httpClient, this.errorHandler, this.logger), this.eventManager = new pc(this.eventRepository, this.userSessionManager, this.errorHandler, this.logger);
3268
- }
3269
- /**
3270
- * Load configuration
3271
- */
3272
- loadConfig() {
3273
- var e;
3274
- o.lifecycle.writeKey.value && this.httpClient.setAuthHeader(o.lifecycle.writeKey.value), (e = this.configManager) == null || e.init();
3275
- }
3276
- /**
3277
- * Initialize the storage and event queue
3278
- */
3279
- onPluginsReady() {
3280
- var e, t, s, r, i;
3281
- (e = this.storeManager) == null || e.init(), (t = this.userSessionManager) == null || t.init(), o.consents.enabled.value && !o.consents.initialized.value && ((s = this.pluginsManager) == null || s.invokeSingle("consentManager.init", o, this.logger), o.consents.preConsent.value.enabled === !1 && ((r = this.pluginsManager) == null || r.invokeSingle("consentManager.updateConsentsInfo", o, this.storeManager, this.logger))), (i = this.eventManager) == null || i.init(), o.lifecycle.status.value = "initialized";
3282
- }
3283
- /**
3284
- * Load plugins
3285
- */
3286
- onConfigured() {
3287
- var e;
3288
- (e = this.pluginsManager) == null || e.init();
3289
- }
3290
- /**
3291
- * Trigger onLoaded callback if any is provided in config & emit initialised event
3292
- */
3293
- onInitialized() {
3294
- this.processDataInPreloadBuffer();
3295
- const e = o.loadOptions.value.onLoaded;
3296
- et(e, [globalThis.rudderanalytics], Rr, this.logger), $(() => {
3297
- o.lifecycle.loaded.value = !0, o.lifecycle.status.value = "loaded";
3298
- }), this.initialized = !0, Tn("RSA_Initialised");
3299
- }
3300
- /**
3301
- * Emit ready event
3302
- */
3303
- // eslint-disable-next-line class-methods-use-this
3304
- onReady() {
3305
- o.lifecycle.status.value = "readyExecuted", o.eventBuffer.readyCallbacksArray.value.forEach((e) => {
3306
- et(e, [], ct, this.logger);
3307
- }), Tn("RSA_Ready");
3308
- }
3309
- /**
3310
- * Consume preloaded events buffer
3311
- */
3312
- processBufferedEvents() {
3313
- let e = o.eventBuffer.toBeProcessedArray.value;
3314
- for (; e.length > 0; ) {
3315
- const t = e.shift();
3316
- if (o.eventBuffer.toBeProcessedArray.value = e, t) {
3317
- const s = t[0];
3318
- v(this[s]) && this[s](...t.slice(1), !0);
3319
- }
3320
- e = o.eventBuffer.toBeProcessedArray.value;
3321
- }
3322
- }
3323
- /**
3324
- * Load device mode destinations
3325
- */
3326
- loadDestinations() {
3327
- var t, s;
3328
- if (o.nativeDestinations.clientDestinationsReady.value)
3329
- return;
3330
- (t = this.pluginsManager) == null || t.invokeSingle("nativeDestinations.setActiveDestinations", o, this.pluginsManager, this.errorHandler, this.logger);
3331
- const e = o.nativeDestinations.activeDestinations.value.length;
3332
- if (e === 0) {
3333
- o.lifecycle.status.value = "destinationsReady";
3334
- return;
3335
- }
3336
- o.lifecycle.status.value = "destinationsLoading", (s = this.pluginsManager) == null || s.invokeSingle("nativeDestinations.load", o, this.externalSrcLoader, this.errorHandler, this.logger), J(() => {
3337
- (e === 0 || o.nativeDestinations.initializedDestinations.value.length + o.nativeDestinations.failedDestinations.value.length === e) && $(() => {
3338
- o.lifecycle.status.value = "destinationsReady", o.nativeDestinations.clientDestinationsReady.value = !0;
3339
- });
3340
- });
3341
- }
3342
- /**
3343
- * Move to the ready state
3344
- */
3345
- // eslint-disable-next-line class-methods-use-this
3346
- onDestinationsReady() {
3347
- o.lifecycle.status.value !== "ready" && (o.lifecycle.status.value = "ready");
3348
- }
3349
- // End lifecycle methods
3350
- // Start consumer exposed methods
3351
- ready(e, t = !1) {
3352
- const s = "ready";
3353
- if (!o.lifecycle.loaded.value) {
3354
- o.eventBuffer.toBeProcessedArray.value = [...o.eventBuffer.toBeProcessedArray.value, [s, e]];
3355
- return;
3356
- }
3357
- if (this.errorHandler.leaveBreadcrumb(`New ${s} invocation`), !v(e)) {
3358
- this.logger.error(Xn(ct));
3359
- return;
3360
- }
3361
- o.lifecycle.status.value === "readyExecuted" ? et(e, [], ct, this.logger) : o.eventBuffer.readyCallbacksArray.value = [...o.eventBuffer.readyCallbacksArray.value, e];
3362
- }
3363
- page(e, t = !1) {
3364
- var r;
3365
- const s = "page";
3366
- if (!o.lifecycle.loaded.value) {
3367
- o.eventBuffer.toBeProcessedArray.value = [...o.eventBuffer.toBeProcessedArray.value, [s, e]];
3368
- return;
3369
- }
3370
- this.errorHandler.leaveBreadcrumb(`New ${s} event`), o.metrics.triggered.value += 1, (r = this.eventManager) == null || r.addEvent({ type: "page", category: e.category, name: e.name, properties: e.properties, options: e.options, callback: e.callback }), o.capabilities.isAdBlocked.value === !0 && e.category !== Xt && this.page(st(Xt, Vr, {
3371
- // 'title' is intentionally omitted as it does not make sense
3372
- // in v3 implementation
3373
- path: jr
3374
- }, o.loadOptions.value.sendAdblockPageOptions));
3375
- }
3376
- track(e, t = !1) {
3377
- var r;
3378
- const s = "track";
3379
- if (!o.lifecycle.loaded.value) {
3380
- o.eventBuffer.toBeProcessedArray.value = [...o.eventBuffer.toBeProcessedArray.value, [s, e]];
3381
- return;
3382
- }
3383
- this.errorHandler.leaveBreadcrumb(`New ${s} event - ${e.name}`), o.metrics.triggered.value += 1, (r = this.eventManager) == null || r.addEvent({ type: s, name: e.name || void 0, properties: e.properties, options: e.options, callback: e.callback });
3384
- }
3385
- identify(e, t = !1) {
3386
- var i, a, l;
3387
- const s = "identify";
3388
- if (!o.lifecycle.loaded.value) {
3389
- o.eventBuffer.toBeProcessedArray.value = [...o.eventBuffer.toBeProcessedArray.value, [s, e]];
3390
- return;
3391
- }
3392
- this.errorHandler.leaveBreadcrumb(`New ${s} event`), o.metrics.triggered.value += 1, !!(e.userId && o.session.userId.value && e.userId !== o.session.userId.value) && this.reset(), j(e.userId) || (i = this.userSessionManager) == null || i.setUserId(e.userId), (a = this.userSessionManager) == null || a.setUserTraits(e.traits), (l = this.eventManager) == null || l.addEvent({ type: s, userId: e.userId, traits: e.traits, options: e.options, callback: e.callback });
3393
- }
3394
- alias(e, t = !1) {
3395
- var i, a, l;
3396
- const s = "alias";
3397
- if (!o.lifecycle.loaded.value) {
3398
- o.eventBuffer.toBeProcessedArray.value = [...o.eventBuffer.toBeProcessedArray.value, [s, e]];
3399
- return;
3400
- }
3401
- this.errorHandler.leaveBreadcrumb(`New ${s} event`), o.metrics.triggered.value += 1;
3402
- const r = e.from ?? ((i = this.userSessionManager) == null ? void 0 : i.getUserId()) ?? ((a = this.userSessionManager) == null ? void 0 : a.getAnonymousId());
3403
- (l = this.eventManager) == null || l.addEvent({ type: s, to: e.to, from: r, options: e.options, callback: e.callback });
3404
- }
3405
- group(e, t = !1) {
3406
- var r, i, a;
3407
- const s = "group";
3408
- if (!o.lifecycle.loaded.value) {
3409
- o.eventBuffer.toBeProcessedArray.value = [...o.eventBuffer.toBeProcessedArray.value, [s, e]];
3410
- return;
3411
- }
3412
- this.errorHandler.leaveBreadcrumb(`New ${s} event`), o.metrics.triggered.value += 1, j(e.groupId) || (r = this.userSessionManager) == null || r.setGroupId(e.groupId), (i = this.userSessionManager) == null || i.setGroupTraits(e.traits), (a = this.eventManager) == null || a.addEvent({ type: s, groupId: e.groupId, traits: e.traits, options: e.options, callback: e.callback });
3413
- }
3414
- reset(e, t = !1) {
3415
- var r;
3416
- const s = "reset";
3417
- if (!o.lifecycle.loaded.value) {
3418
- o.eventBuffer.toBeProcessedArray.value = [...o.eventBuffer.toBeProcessedArray.value, [s, e]];
3419
- return;
3420
- }
3421
- this.errorHandler.leaveBreadcrumb(`New ${s} invocation, resetAnonymousId: ${e}`), (r = this.userSessionManager) == null || r.reset(e);
3422
- }
3423
- getAnonymousId(e) {
3424
- var t;
3425
- return (t = this.userSessionManager) == null ? void 0 : t.getAnonymousId(e);
3426
- }
3427
- setAnonymousId(e, t, s = !1) {
3428
- var i;
3429
- const r = "setAnonymousId";
3430
- if (!o.lifecycle.loaded.value) {
3431
- o.eventBuffer.toBeProcessedArray.value = [...o.eventBuffer.toBeProcessedArray.value, [r, e, t]];
3432
- return;
3433
- }
3434
- this.errorHandler.leaveBreadcrumb(`New ${r} invocation`), (i = this.userSessionManager) == null || i.setAnonymousId(e, t);
3435
- }
3436
- // eslint-disable-next-line class-methods-use-this
3437
- getUserId() {
3438
- return o.session.userId.value;
3439
- }
3440
- // eslint-disable-next-line class-methods-use-this
3441
- getUserTraits() {
3442
- return o.session.userTraits.value;
3443
- }
3444
- // eslint-disable-next-line class-methods-use-this
3445
- getGroupId() {
3446
- return o.session.groupId.value;
3447
- }
3448
- // eslint-disable-next-line class-methods-use-this
3449
- getGroupTraits() {
3450
- return o.session.groupTraits.value;
3451
- }
3452
- startSession(e, t = !1) {
3453
- var r;
3454
- const s = "startSession";
3455
- if (!o.lifecycle.loaded.value) {
3456
- o.eventBuffer.toBeProcessedArray.value = [...o.eventBuffer.toBeProcessedArray.value, [s, e]];
3457
- return;
3458
- }
3459
- this.errorHandler.leaveBreadcrumb(`New ${s} invocation`), (r = this.userSessionManager) == null || r.start(e);
3460
- }
3461
- endSession(e = !1) {
3462
- var s;
3463
- const t = "endSession";
3464
- if (!o.lifecycle.loaded.value) {
3465
- o.eventBuffer.toBeProcessedArray.value = [...o.eventBuffer.toBeProcessedArray.value, [t]];
3466
- return;
3467
- }
3468
- this.errorHandler.leaveBreadcrumb(`New ${t} invocation`), (s = this.userSessionManager) == null || s.end();
3469
- }
3470
- // eslint-disable-next-line class-methods-use-this
3471
- getSessionId() {
3472
- var t;
3473
- return ((t = this.userSessionManager) == null ? void 0 : t.getSessionId()) ?? null;
3474
- }
3475
- consent(e, t = !1) {
3476
- var r, i, a, l;
3477
- const s = "consent";
3478
- if (!o.lifecycle.loaded.value) {
3479
- o.eventBuffer.toBeProcessedArray.value = [...o.eventBuffer.toBeProcessedArray.value, [s, e]];
3480
- return;
3481
- }
3482
- this.errorHandler.leaveBreadcrumb("New consent invocation"), $(() => {
3483
- o.consents.preConsent.value = { ...o.consents.preConsent.value, enabled: !1 }, o.consents.postConsent.value = wl(e);
3484
- const { initialized: c, consentsData: d } = vs(o.consents.postConsent.value.consentManagement, this.logger);
3485
- o.consents.initialized.value = c || o.consents.initialized.value, o.consents.data.value = d;
3486
- }), o.consents.enabled.value && !o.consents.initialized.value && ((r = this.pluginsManager) == null || r.invokeSingle("consentManager.updateConsentsInfo", o, this.storeManager, this.logger)), (i = this.storeManager) == null || i.initializeStorageState(), (a = this.userSessionManager) == null || a.syncStorageDataToState(), (l = this.eventManager) == null || l.resume(), this.loadDestinations(), this.sendTrackingEvents(t);
3487
- }
3488
- sendTrackingEvents(e) {
3489
- if (o.consents.postConsent.value.trackConsent) {
3490
- const t = Mt(Kr);
3491
- e ? o.eventBuffer.toBeProcessedArray.value = [...o.eventBuffer.toBeProcessedArray.value, ["track", t]] : this.track(t);
3492
- }
3493
- if (o.consents.postConsent.value.sendPageEvent) {
3494
- const t = st();
3495
- e ? o.eventBuffer.toBeProcessedArray.value = [...o.eventBuffer.toBeProcessedArray.value, ["page", t]] : this.page(t);
3496
- }
3497
- }
3498
- setAuthToken(e) {
3499
- var t;
3500
- (t = this.userSessionManager) == null || t.setAuthToken(e);
3501
- }
3502
- // End consumer exposed methods
3503
- }
3504
- const ve = class ve {
3505
- // Singleton with constructor bind methods
3506
- constructor() {
3507
- // END-NO-SONAR-SCAN
3508
- A(this, "analyticsInstances", {});
3509
- A(this, "defaultAnalyticsKey", "");
3510
- A(this, "logger", X);
3511
- try {
3512
- if (ve.globalSingleton)
3513
- return ve.globalSingleton;
3514
- this.setDefaultInstanceKey = this.setDefaultInstanceKey.bind(this), this.getAnalyticsInstance = this.getAnalyticsInstance.bind(this), this.load = this.load.bind(this), this.ready = this.ready.bind(this), this.triggerBufferedLoadEvent = this.triggerBufferedLoadEvent.bind(this), this.page = this.page.bind(this), this.track = this.track.bind(this), this.identify = this.identify.bind(this), this.alias = this.alias.bind(this), this.group = this.group.bind(this), this.reset = this.reset.bind(this), this.getAnonymousId = this.getAnonymousId.bind(this), this.setAnonymousId = this.setAnonymousId.bind(this), this.getUserId = this.getUserId.bind(this), this.getUserTraits = this.getUserTraits.bind(this), this.getGroupId = this.getGroupId.bind(this), this.getGroupTraits = this.getGroupTraits.bind(this), this.startSession = this.startSession.bind(this), this.endSession = this.endSession.bind(this), this.getSessionId = this.getSessionId.bind(this), this.setAuthToken = this.setAuthToken.bind(this), this.consent = this.consent.bind(this), ve.globalSingleton = this, o.autoTrack.pageLifecycle.visitId.value = ot(), o.autoTrack.pageLifecycle.pageLoadedTimestamp.value = Date.now(), this.triggerBufferedLoadEvent(), globalThis.rudderanalytics = this;
3515
- } catch (e) {
3516
- N(e);
3517
- }
3518
- }
3519
- /**
3520
- * Set instance to use if no specific writeKey is provided in methods
3521
- * automatically for the first created instance
3522
- * TODO: to support multiple analytics instances in the near future
3523
- */
3524
- setDefaultInstanceKey(e) {
3525
- P(e) && e && (this.defaultAnalyticsKey = e);
3526
- }
3527
- /**
3528
- * Retrieve an existing analytics instance
3529
- */
3530
- getAnalyticsInstance(e) {
3531
- try {
3532
- let t = e;
3533
- return (!P(t) || !t) && (t = this.defaultAnalyticsKey), !!this.analyticsInstances[t] || (this.analyticsInstances[t] = new On()), this.analyticsInstances[t];
3534
- } catch (t) {
3535
- N(t);
3536
- return;
3537
- }
3538
- }
3539
- /**
3540
- * Loads the SDK
3541
- * @param writeKey Source write key
3542
- * @param dataPlaneUrl Data plane URL
3543
- * @param loadOptions Additional options for loading the SDK
3544
- * @returns none
3545
- */
3546
- load(e, t, s) {
3547
- var r;
3548
- try {
3549
- if (this.analyticsInstances[e])
3550
- return;
3551
- this.setDefaultInstanceKey(e);
3552
- const i = Fn(Pe);
3553
- this.trackPageLifecycleEvents(i, s), ti(i), Me(Pe, S(i)), this.analyticsInstances[e] = new On(), (r = this.getAnalyticsInstance(e)) == null || r.load(e, t, _(s));
3554
- } catch (i) {
3555
- N(i);
3556
- }
3557
- }
3558
- /**
3559
- * A function to track page lifecycle events like page loaded and page unloaded
3560
- * @param preloadedEventsArray
3561
- * @param loadOptions
3562
- * @returns
3563
- */
3564
- trackPageLifecycleEvents(e, t) {
3565
- const { autoTrack: s, useBeacon: r } = t ?? {}, { enabled: i = !1, options: a = {}, pageLifecycle: l } = s ?? {}, { events: c = [fe.LOADED, fe.UNLOADED], enabled: d = i, options: u = a } = l ?? {};
3566
- o.autoTrack.pageLifecycle.enabled.value = d, o.autoTrack.enabled.value = i || d, d && (this.trackPageLoadedEvent(c, u, e), this.setupPageUnloadTracking(c, r, u));
3567
- }
3568
- /**
3569
- * Buffer the page loaded event in the preloaded events array
3570
- * @param events
3571
- * @param options
3572
- * @param preloadedEventsArray
3573
- */
3574
- // eslint-disable-next-line class-methods-use-this
3575
- trackPageLoadedEvent(e, t, s) {
3576
- (e.length === 0 || e.includes(fe.LOADED)) && s.unshift(["track", fe.LOADED, {}, { ...t, originalTimestamp: St(new Date(o.autoTrack.pageLifecycle.pageLoadedTimestamp.value)) }]);
3577
- }
3578
- /**
3579
- * Setup page unload tracking if enabled
3580
- * @param events
3581
- * @param useBeacon
3582
- * @param options
3583
- */
3584
- setupPageUnloadTracking(e, t, s) {
3585
- (e.length === 0 || e.includes(fe.UNLOADED)) && (t === !0 ? Nr((r) => {
3586
- if (r === !1 && o.lifecycle.loaded.value) {
3587
- const i = Date.now(), a = i - o.autoTrack.pageLifecycle.pageLoadedTimestamp.value;
3588
- this.track(fe.UNLOADED, { visitDuration: a }, { ...s, originalTimestamp: St(new Date(i)) });
3589
- }
3590
- }) : this.logger.warn(fo(Or)));
3591
- }
3592
- /**
3593
- * Trigger load event in buffer queue if exists and stores the
3594
- * remaining preloaded events array in global object
3595
- */
3596
- triggerBufferedLoadEvent() {
3597
- const e = Array.isArray(globalThis.rudderanalytics) ? globalThis.rudderanalytics : [], t = ei(e);
3598
- Me(Pe, S([...e])), t.length > 0 && (t.shift(), this.load.apply(null, t));
3599
- }
3600
- /**
3601
- * Get ready callback arguments and forward to ready call
3602
- */
3603
- ready(e) {
3604
- var t;
3605
- try {
3606
- (t = this.getAnalyticsInstance()) == null || t.ready(_(e));
3607
- } catch (s) {
3608
- N(s);
3609
- }
3610
- }
3611
- /**
3612
- * Process page arguments and forward to page call
3613
- */
3614
- // These overloads should be same as AnalyticsPageMethod in @rudderstack/analytics-js-common/types/IRudderAnalytics
3615
- page(e, t, s, r, i) {
3616
- var a;
3617
- try {
3618
- (a = this.getAnalyticsInstance()) == null || a.page(st(_(e), _(t), _(s), _(r), _(i)));
3619
- } catch (l) {
3620
- N(l);
3621
- }
3622
- }
3623
- /**
3624
- * Process track arguments and forward to page call
3625
- */
3626
- // These overloads should be same as AnalyticsTrackMethod in @rudderstack/analytics-js-common/types/IRudderAnalytics
3627
- track(e, t, s, r) {
3628
- var i;
3629
- try {
3630
- (i = this.getAnalyticsInstance()) == null || i.track(Mt(_(e), _(t), _(s), _(r)));
3631
- } catch (a) {
3632
- N(a);
3633
- }
3634
- }
3635
- /**
3636
- * Process identify arguments and forward to page call
3637
- */
3638
- // These overloads should be same as AnalyticsIdentifyMethod in @rudderstack/analytics-js-common/types/IRudderAnalytics
3639
- identify(e, t, s, r) {
3640
- var i;
3641
- try {
3642
- (i = this.getAnalyticsInstance()) == null || i.identify(Pn(_(e), _(t), _(s), _(r)));
3643
- } catch (a) {
3644
- N(a);
3645
- }
3646
- }
3647
- /**
3648
- * Process alias arguments and forward to page call
3649
- */
3650
- // These overloads should be same as AnalyticsAliasMethod in @rudderstack/analytics-js-common/types/IRudderAnalytics
3651
- alias(e, t, s, r) {
3652
- var i;
3653
- try {
3654
- (i = this.getAnalyticsInstance()) == null || i.alias(Ln(_(e), _(t), _(s), _(r)));
3655
- } catch (a) {
3656
- N(a);
3657
- }
3658
- }
3659
- /**
3660
- * Process group arguments and forward to page call
3661
- */
3662
- // These overloads should be same as AnalyticsGroupMethod in @rudderstack/analytics-js-common/types/IRudderAnalytics
3663
- group(e, t, s, r) {
3664
- var i;
3665
- try {
3666
- (i = this.getAnalyticsInstance()) == null || i.group(wn(_(e), _(t), _(s), _(r)));
3667
- } catch (a) {
3668
- N(a);
3669
- }
3670
- }
3671
- reset(e) {
3672
- var t;
3673
- try {
3674
- (t = this.getAnalyticsInstance()) == null || t.reset(_(e));
3675
- } catch (s) {
3676
- N(s);
3677
- }
3678
- }
3679
- getAnonymousId(e) {
3680
- var t;
3681
- try {
3682
- return (t = this.getAnalyticsInstance()) == null ? void 0 : t.getAnonymousId(_(e));
3683
- } catch (s) {
3684
- N(s);
3685
- return;
3686
- }
3687
- }
3688
- setAnonymousId(e, t) {
3689
- var s;
3690
- try {
3691
- (s = this.getAnalyticsInstance()) == null || s.setAnonymousId(_(e), _(t));
3692
- } catch (r) {
3693
- N(r);
3694
- }
3695
- }
3696
- getUserId() {
3697
- var e;
3698
- try {
3699
- return (e = this.getAnalyticsInstance()) == null ? void 0 : e.getUserId();
3700
- } catch (t) {
3701
- N(t);
3702
- return;
3703
- }
3704
- }
3705
- getUserTraits() {
3706
- var e;
3707
- try {
3708
- return (e = this.getAnalyticsInstance()) == null ? void 0 : e.getUserTraits();
3709
- } catch (t) {
3710
- N(t);
3711
- return;
3712
- }
3713
- }
3714
- getGroupId() {
3715
- var e;
3716
- try {
3717
- return (e = this.getAnalyticsInstance()) == null ? void 0 : e.getGroupId();
3718
- } catch (t) {
3719
- N(t);
3720
- return;
3721
- }
3722
- }
3723
- getGroupTraits() {
3724
- var e;
3725
- try {
3726
- return (e = this.getAnalyticsInstance()) == null ? void 0 : e.getGroupTraits();
3727
- } catch (t) {
3728
- N(t);
3729
- return;
3730
- }
3731
- }
3732
- startSession(e) {
3733
- var t;
3734
- try {
3735
- (t = this.getAnalyticsInstance()) == null || t.startSession(_(e));
3736
- } catch (s) {
3737
- N(s);
3738
- }
3739
- }
3740
- endSession() {
3741
- var e;
3742
- try {
3743
- (e = this.getAnalyticsInstance()) == null || e.endSession();
3744
- } catch (t) {
3745
- N(t);
3746
- }
3747
- }
3748
- getSessionId() {
3749
- var e;
3750
- try {
3751
- return (e = this.getAnalyticsInstance()) == null ? void 0 : e.getSessionId();
3752
- } catch (t) {
3753
- N(t);
3754
- return;
3755
- }
3756
- }
3757
- setAuthToken(e) {
3758
- var t;
3759
- try {
3760
- (t = this.getAnalyticsInstance()) == null || t.setAuthToken(_(e));
3761
- } catch (s) {
3762
- N(s);
3763
- }
3764
- }
3765
- consent(e) {
3766
- var t;
3767
- try {
3768
- (t = this.getAnalyticsInstance()) == null || t.consent(_(e));
3769
- } catch (s) {
3770
- N(s);
3771
- }
3772
- }
3773
- };
3774
- // START-NO-SONAR-SCAN
3775
- // eslint-disable-next-line sonarjs/public-static-readonly
3776
- A(ve, "globalSingleton", null);
3777
- let Ct = ve;
3778
- const Oc = {
3779
- STAGING: "2R6llJi7YSuOeJToPXGlQfizt18",
3780
- SANDBOX: "2R6mEpjiTJBErRIn724pt2MWyLA",
3781
- LOCAL: "2QHmFAx84bL4Up6CDHRw0XkKJKC",
3782
- LIVE: "2R6mT9xSJCcbvr6JkiEu7vbrUSW"
3783
- }, Ac = "https://revolugohxxwg.dataplane.rudderstack.com", Dc = window.RevolugoElements.config.apiEnvironment, kc = Oc[Dc], Rs = new Ct();
3784
- try {
3785
- Rs.load(kc, Ac);
3786
- } catch (n) {
3787
- console.error(n);
3788
- }
3789
- const Is = {
3790
- startDate: {
3791
- type: String
3792
- },
3793
- endDate: {
3794
- type: String
3795
- },
3796
- roomCount: {
3797
- type: Number
3798
- },
3799
- adultCount: {
3800
- type: Number
3801
- },
3802
- location: {
3803
- type: Object
3804
- }
3805
- }, Cc = Dn.extend({
3806
- name: "ContactForm",
3807
- components: {
3808
- BSearchLocationInput: $s,
3809
- BPhoneInput: Hs
3810
- },
3811
- mixins: [Nt("components/RevolugoElements/ContactForm")],
3812
- props: Is,
3813
- data() {
3814
- return {
3815
- isFormValid: !1,
3816
- isSubmitting: !1,
3817
- isSuccess: !1,
3818
- errorCode: "",
3819
- menuStartDate: !1,
3820
- menuEndDate: !1,
3821
- formData: {
3822
- email: "",
3823
- phoneData: {
3824
- phoneNumber: "",
3825
- phoneCountry: "FR",
3826
- phonePrefix: "+33"
3827
- },
3828
- startDate: this.startDate,
3829
- endDate: this.endDate,
3830
- adultCount: this.adultCount,
3831
- roomCount: this.roomCount,
3832
- location: this.location,
3833
- specificRequest: ""
3834
- },
3835
- rules: {
3836
- email: [
3837
- (n) => de.required(n) || this.$t("ContactForm.errors.requiredEmail"),
3838
- (n) => de.email(n) || this.$t("ContactForm.errors.invalidEmail")
3839
- ],
3840
- adultCount: [
3841
- (n) => de.minCount(n, 1) || this.$t("ContactForm.errors.minAdultCount"),
3842
- (n) => de.maxCount(n, 400) || this.$t("ContactForm.errors.maxAdultCount")
3843
- ],
3844
- roomCount: [
3845
- (n) => de.minCount(n, 1) || this.$t("ContactForm.errors.minRoomCount"),
3846
- (n) => de.maxCount(n, 100) || this.$t("ContactForm.errors.maxRoomCount")
3847
- ]
3848
- }
3849
- };
3850
- },
3851
- methods: {
3852
- onSubmit() {
3853
- var e;
3854
- this.isSubmitting = !0;
3855
- let n = "";
3856
- (e = this.config) != null && e.eventMetadata && (n = this.config.eventMetadata.name, this.config.eventMetadata.slug && (n += ` ${this.config.eventMetadata.slug}`)), Rs.track(
3857
- "accommodation-request",
3858
- {
3859
- data: {
3860
- ...this.formData,
3861
- event: n
3862
- }
3863
- },
3864
- () => {
3865
- this.isSuccess = !0, this.isSubmitting = !1, this.$emit("accommodationSuccess");
3866
- }
3867
- );
3868
- }
3869
- }
3870
- });
3871
- var Nc = function() {
3872
- var e = this, t = e._self._c;
3873
- return e._self._setupProxy, t("div", [t(js, { model: { value: e.isFormValid, callback: function(s) {
3874
- e.isFormValid = s;
3875
- }, expression: "isFormValid" } }, [t(Te, { attrs: { dense: "", label: e.$t("ContactForm.email"), outlined: "", required: "", rules: e.rules.email }, scopedSlots: e._u([{ key: "message", fn: function({ message: s }) {
3876
- return [e._v(" " + e._s(e.$t(s)) + " ")];
3877
- } }]), model: { value: e.formData.email, callback: function(s) {
3878
- e.$set(e.formData, "email", s);
3879
- }, expression: "formData.email" } }), t("BPhoneInput", { staticClass: "mt-0", model: { value: e.formData.phoneData, callback: function(s) {
3880
- e.$set(e.formData, "phoneData", s);
3881
- }, expression: "formData.phoneData" } }), t(Ne, { staticClass: "mt-0" }, [t(le, [t(Gt, { attrs: { "close-on-content-click": !1, "min-width": "auto", "nudge-right": 40, "offset-y": "", transition: "scale-transition" }, scopedSlots: e._u([{ key: "activator", fn: function({ on: s, attrs: r }) {
3882
- return [t(Te, e._g(e._b({ attrs: { dense: "", "hide-details": "", label: e.$t("ContactForm.startDate"), outlined: "", readonly: "", required: "" }, model: { value: e.formData.startDate, callback: function(i) {
3883
- e.$set(e.formData, "startDate", i);
3884
- }, expression: "formData.startDate" } }, "VTextField", r, !1), s))];
3885
- } }]), model: { value: e.menuStartDate, callback: function(s) {
3886
- e.menuStartDate = s;
3887
- }, expression: "menuStartDate" } }, [t(Vt, { on: { input: function(s) {
3888
- e.menuStartDate = !1;
3889
- } }, model: { value: e.formData.startDate, callback: function(s) {
3890
- e.$set(e.formData, "startDate", s);
3891
- }, expression: "formData.startDate" } })], 1)], 1), t(le, [t(Gt, { attrs: { "close-on-content-click": !1, "min-width": "auto", "nudge-right": 40, "offset-y": "", transition: "scale-transition" }, scopedSlots: e._u([{ key: "activator", fn: function({ on: s, attrs: r }) {
3892
- return [t(Te, e._g(e._b({ attrs: { dense: "", "hide-details": "", label: e.$t("ContactForm.endDate"), outlined: "", readonly: "", required: "" }, model: { value: e.formData.endDate, callback: function(i) {
3893
- e.$set(e.formData, "endDate", i);
3894
- }, expression: "formData.endDate" } }, "VTextField", r, !1), s))];
3895
- } }]), model: { value: e.menuEndDate, callback: function(s) {
3896
- e.menuEndDate = s;
3897
- }, expression: "menuEndDate" } }, [t(Vt, { on: { input: function(s) {
3898
- e.menuEndDate = !1;
3899
- } }, model: { value: e.formData.endDate, callback: function(s) {
3900
- e.$set(e.formData, "endDate", s);
3901
- }, expression: "formData.endDate" } })], 1)], 1)], 1), t(Ne, [t(le, [t(Te, { attrs: { dense: "", label: e.$t("ContactForm.adultCount"), max: "400", min: "1", outlined: "", required: "", rules: e.rules.adultCount, type: "number" }, model: { value: e.formData.adultCount, callback: function(s) {
3902
- e.$set(e.formData, "adultCount", s);
3903
- }, expression: "formData.adultCount" } })], 1), t(le, [t(Te, { attrs: { dense: "", label: e.$t("ContactForm.roomCount"), max: "400", min: "1", outlined: "", required: "", rules: e.rules.roomCount, type: "number" }, model: { value: e.formData.roomCount, callback: function(s) {
3904
- e.$set(e.formData, "roomCount", s);
3905
- }, expression: "formData.roomCount" } })], 1)], 1), t("BSearchLocationInput", { attrs: { outlined: "", "with-details": "" }, model: { value: e.formData.location, callback: function(s) {
3906
- e.$set(e.formData, "location", s);
3907
- }, expression: "formData.location" } }), t(Gs, { attrs: { dense: "", label: e.$t("ContactForm.specificRequest"), outlined: "" }, model: { value: e.formData.specificRequest, callback: function(s) {
3908
- e.$set(e.formData, "specificRequest", s);
3909
- }, expression: "formData.specificRequest" } }), t("div", { staticClass: "d-flex justify-end" }, [t(Lt, { attrs: { color: e.isSuccess ? "green" : "primary", "data-cy": "submit-button", "data-attr": "submit-button", disabled: !e.isFormValid || e.isSubmitting || e.isSuccess, loading: e.isSubmitting }, on: { click: function(s) {
3910
- return e.onSubmit();
3911
- } } }, [e._v(" " + e._s(e.$t("ContactForm.submit")) + " ")])], 1)], 1)], 1);
3912
- }, Pc = [], Lc = /* @__PURE__ */ Pt(
3913
- Cc,
3914
- Nc,
3915
- Pc,
3916
- !1,
3917
- null,
3918
- null
3919
- );
3920
- const wc = Lc.exports, $c = {
3921
- ...Is,
3922
- boilerplateSkeleton: {
3923
- type: Boolean
3924
- },
3925
- itemCount: {
3926
- type: Number,
3927
- default: 3
3928
- },
3929
- type: {
3930
- type: String
3931
- },
3932
- checkInDate: {
3933
- type: String
3934
- },
3935
- checkOutDate: {
3936
- type: String
3937
- }
3938
- }, Mc = Dn.extend({
3939
- name: "HotelOfferListEmpty",
3940
- components: {
3941
- BErrorOverlay: Vs,
3942
- HotelOfferItemLayout: An,
3943
- ContactForm: wc
3944
- },
3945
- mixins: [Nt("components/RevolugoElements/HotelOfferListEmpty"), kn],
3946
- props: $c,
3947
- data() {
3948
- return {
3949
- typeData: this.type
3950
- };
3951
- },
3952
- computed: {
3953
- wording() {
3954
- let n = {
3955
- title: "",
3956
- description: ""
3957
- };
3958
- if (this.typeData)
3959
- switch (this.typeData) {
3960
- case "internalError": {
3961
- n = {
3962
- title: this.$t("HotelOfferListEmpty.internalError.title"),
3963
- description: this.$t(
3964
- "HotelOfferListEmpty.internalError.description"
3965
- )
3966
- };
3967
- break;
3968
- }
3969
- case "missingHotelOfferRequest": {
3970
- n = {
3971
- title: this.$t(
3972
- "HotelOfferListEmpty.missingHotelOfferRequest.title"
3973
- ),
3974
- description: this.$t(
3975
- "HotelOfferListEmpty.missingHotelOfferRequest.description"
3976
- )
3977
- };
3978
- break;
3979
- }
3980
- case "accommodationSuccess": {
3981
- n = {
3982
- title: this.$t("HotelOfferListEmpty.accommodationSuccess.title"),
3983
- description: this.$t(
3984
- "HotelOfferListEmpty.accommodationSuccess.description"
3985
- )
3986
- };
3987
- break;
3988
- }
3989
- case "noResultsFiltered": {
3990
- n = {
3991
- title: this.$t("HotelOfferListEmpty.noResults.title"),
3992
- description: this.$t(
3993
- "HotelOfferListEmpty.noResultsFiltered.description"
3994
- )
3995
- };
3996
- break;
3997
- }
3998
- default: {
3999
- n = {
4000
- title: this.$t("HotelOfferListEmpty.noResults.title"),
4001
- description: this.$t("HotelOfferListEmpty.noResults.description")
4002
- };
4003
- break;
4004
- }
4005
- }
4006
- return n;
4007
- }
4008
- },
4009
- watch: {
4010
- type: {
4011
- immediate: !1,
4012
- handler() {
4013
- this.typeData = this.type;
4014
- }
4015
- }
4016
- },
4017
- methods: {
4018
- onResetFilters() {
4019
- this.$emit("reset-filters");
4020
- }
4021
- }
4022
- });
4023
- var Uc = function() {
4024
- var e = this, t = e._self._c;
4025
- return e._self._setupProxy, t("div", { staticClass: "position-relative" }, [e._l(6, function(s) {
4026
- return [t("HotelOfferItemLayout", { key: s, class: {
4027
- "mt-0": s === 1,
4028
- "mb-0": s === e.itemCount,
4029
- "mb-2": e.$breakpointService.xs
4030
- }, attrs: { boilerplate: e.boilerplateSkeleton } }), e.$breakpointService.xs ? e._e() : t(Et, { key: s + "-divider" })];
4031
- }), e.typeData ? t("BErrorOverlay", { scopedSlots: e._u([{ key: "title", fn: function() {
4032
- return [e._v(" " + e._s(e.wording.title) + " ")];
4033
- }, proxy: !0 }, { key: "description", fn: function() {
4034
- return [t("div", [t("p", [e._v(e._s(e.wording.description))]), e.typeData !== "noResultsFiltered" && e.typeData !== "accommodationSuccess" ? t("ContactForm", { attrs: { "adult-count": e.adultCount, "end-date": e.checkOutDate, location: e.location, "room-count": e.roomCount, "start-date": e.checkInDate }, on: { accommodationSuccess: function(s) {
4035
- e.typeData = "accommodationSuccess";
4036
- } } }) : e._e(), e.typeData === "noResultsFiltered" ? t(Lt, { attrs: { color: "primary", outlined: "", small: "" }, on: { click: e.onResetFilters } }, [e._v(" " + e._s(e.$t("HotelOfferListEmpty.noResultsFiltered.reset")) + " ")]) : e._e()], 1)];
4037
- }, proxy: !0 }], null, !1, 1236007322) }) : e._e()], 2);
4038
- }, Bc = [], xc = /* @__PURE__ */ Pt(
4039
- Mc,
4040
- Uc,
4041
- Bc,
4042
- !1,
4043
- null,
4044
- null
4045
- );
4046
- const Fc = xc.exports, Hc = zs(
4047
- Ls,
4048
- qs({
4049
- fallbackValue: {},
4050
- propsName: "features"
4051
- })
4052
- ).extend({
4053
- name: "HotelOfferList",
4054
- components: {
4055
- BHotelOffersFilterBar: Bs,
4056
- BHotelSearchBar: Ws,
4057
- HotelOfferItem: Us,
4058
- HotelOfferItemLayout: An,
4059
- HotelOfferListEmpty: Fc,
4060
- HotelRoomOfferList: Qs,
4061
- TermsAndConditions: Ys
4062
- },
4063
- mixins: [
4064
- kn,
4065
- Nt("components/RevolugoElements/HotelOfferList"),
4066
- Ms,
4067
- Xs(
4068
- ["bookingApiClient", "config.currency", "config.lang"],
4069
- "retrieveHotelOffers"
4070
- )
4071
- ],
4072
- store: Ns,
4073
- props: er,
4074
- computed: {
4075
- areFiltersActive: Z("hotelOffers/areFiltersActive"),
4076
- hasErrorHotelOffers: Z("hotelOffers/hasError"),
4077
- hotelOffersCurrency: Z(
4078
- "hotelOffers/hotelOffersCurrency"
4079
- ),
4080
- isPollingHotelOffers: Z("hotelOffers/isPolling"),
4081
- startingAfter: Z("hotelOffers/startingAfter"),
4082
- filters: Z("hotelOffers/filters"),
4083
- hotelOffers: Z("hotelOffers/hotelOffers"),
4084
- hotelOfferRequest: Z("hotelOfferRequest"),
4085
- displayFiltersMenu() {
4086
- return !this.isHotelOfferRequestMissing && !!this.parsedFeatures.FiltersBar;
4087
- },
4088
- isTopPicksSelected() {
4089
- var n;
4090
- return ((n = this.filters.sort_by) == null ? void 0 : n.value) === Cs.TopPicks;
4091
- },
4092
- showNoResultsMessage() {
4093
- return !!this.hotelOfferRequest.id && !this.isPollingHotelOffers && Array.isArray(this.hotelOffers) && this.hotelOffers.length === 0;
4094
- },
4095
- showErrorMessage() {
4096
- return this.hotelOfferRequest.hasError || this.hasErrorHotelOffers;
4097
- },
4098
- showSkeleton() {
4099
- var n;
4100
- return !this.hotelOfferRequest.id || this.hotelOfferRequest.isFetching || this.isPollingHotelOffers && (!this.hotelOffers || ((n = this.hotelOffers) == null ? void 0 : n.length) === 0);
4101
- }
4102
- },
4103
- watch: {
4104
- filters: {
4105
- deep: !0,
4106
- async handler(n, e) {
4107
- Fs(n, e) || await this.retrieveHotelOffers();
4108
- }
4109
- },
4110
- "hotelOfferRequest.id": {
4111
- immediate: !0,
4112
- handler() {
4113
- this.$nextTick(async () => {
4114
- await this.retrieveHotelOffers();
4115
- });
4116
- }
4117
- },
4118
- limit: {
4119
- immediate: !0,
4120
- handler() {
4121
- this.$nextTick(async () => {
4122
- await this.retrieveHotelOffers();
4123
- });
4124
- }
4125
- }
4126
- },
4127
- methods: {
4128
- onHotelOfferItemMouseover(n) {
4129
- this.$emit("hotel-offer-item-mouseover", n);
4130
- },
4131
- onHotelOfferItemMouseleave() {
4132
- this.$emit("hotel-offer-item-mouseleave");
4133
- },
4134
- async onResetFilters() {
4135
- await Ie("hotelOffers/resetFilters");
4136
- },
4137
- async retrieveHotelOffers() {
4138
- this.$refs["hotel-offer-list-container"].scrollTo({
4139
- top: 0,
4140
- behavior: "smooth"
4141
- }), await Ie("hotelRoomOfferRequest/resetHotelRoomOfferRequests").then(() => Ie("hotelRoomOffers/resetHotelRoomOffers")).then(
4142
- () => Ie("hotelOffers/retrieveHotelOffers", {
4143
- hotelOfferRequestId: this.hotelOfferRequest.id,
4144
- limit: this.limit
4145
- })
4146
- );
4147
- },
4148
- async onSeeMoreClick() {
4149
- await Ie("hotelOffers/retrieveHotelOffers", {
4150
- hotelOfferRequestId: this.hotelOfferRequest.id,
4151
- limit: this.limit,
4152
- startingAfter: this.startingAfter
4153
- });
4154
- }
4155
- }
4156
- });
4157
- var Gc = function() {
4158
- var e = this, t = e._self._c;
4159
- return e._self._setupProxy, t(Ks, { ref: "hotel-offer-list-container", staticClass: "pa-0 white", staticStyle: { "min-height": "500px" }, style: {
4160
- height: e.parsedHeight,
4161
- maxHeight: e.maxHeight,
4162
- overflowY: "auto",
4163
- overflowX: "hidden"
4164
- } }, [e.parsedFeatures.HotelOfferSearchMenu ? t(Ne, { staticClass: "px-2 pt-4", class: e.$isCurrentBreakpointAboveOrEqual("md") ? "sticky" : "", attrs: { "no-gutters": "" } }, [t(le, [e.isBookingApiClientDefined ? t("BHotelSearchBar", { attrs: { "is-fetching": e.showSkeleton, "loading-bar-enabled": !1, "with-border": !1 }, model: { value: e.hotelOfferRequestInternal, callback: function(s) {
4165
- e.hotelOfferRequestInternal = s;
4166
- }, expression: "hotelOfferRequestInternal" } }) : e._e()], 1)], 1) : e._e(), e.displayFiltersMenu && e.isBookingApiClientDefined ? t(Ne, { class: e.$isCurrentBreakpointAboveOrEqual("md") ? "sticky" : "", attrs: { "no-gutters": "" } }, [t(le, [t("BHotelOffersFilterBar"), e.$breakpointService.xs ? e._e() : t(Et)], 1)], 1) : e._e(), t(Ne, { attrs: { "no-gutters": "" } }, [t(le, [e.showSkeleton ? [t("HotelOfferListEmpty")] : e.showErrorMessage ? [t("HotelOfferListEmpty", { attrs: { type: "internalError" } })] : e.showNoResultsMessage ? [t("HotelOfferListEmpty", { attrs: { address: e.hotelOfferRequest.address, "adult-count": e.hotelOfferRequest.adultCount, "check-in-date": e.hotelOfferRequest.checkInDate, "check-out-date": e.hotelOfferRequest.checkOutDate, latitude: e.hotelOfferRequest.latitude, longitude: e.hotelOfferRequest.longitude, "room-count": e.hotelOfferRequest.roomCount, "source-market": e.hotelOfferRequest.sourceMarket, type: "noResults" }, on: { "reset-filters": e.onResetFilters } })] : [t(Js, { directives: [{ name: "show", rawName: "v-show", value: e.loadingBarEnabled && e.isPollingHotelOffers, expression: "loadingBarEnabled && isPollingHotelOffers" }], attrs: { indeterminate: "" } }), e._l(e.hotelOffers, function(s, r) {
4167
- var i;
4168
- return [t("HotelOfferItem", { key: s.id, staticClass: "pr-3", class: {
4169
- "mt-0": r === 0,
4170
- "mb-0": r === e.hotelOffers.length - 1
4171
- }, attrs: { features: e.parsedFeatures.HotelOfferItem, "hotel-offer": s, "single-offer": e.hotelRoomOffersLimit === 1 }, nativeOn: { mouseleave: function(a) {
4172
- return e.onHotelOfferItemMouseleave.apply(null, arguments);
4173
- }, mouseover: function(a) {
4174
- return e.onHotelOfferItemMouseover(s);
4175
- } } }, [(i = e.parsedFeatures.HotelOfferItem) != null && i.HotelRoomOfferList ? t("div", { staticClass: "mx-n2" }, [t("HotelRoomOfferList", { attrs: { "adult-count": e.hotelOfferRequest.adultCount, "check-in-date": e.hotelOfferRequest.checkInDate, "check-out-date": e.hotelOfferRequest.checkOutDate, children: e.hotelOfferRequest.children, "hotel-id": s.id, "hotel-timezone": s.timezone, limit: e.hotelRoomOffersLimit, "room-count": e.hotelOfferRequest.roomCount, "source-market": e.hotelOfferRequest.sourceMarket } })], 1) : e._e()]), t(Et, { key: s.id + "-divider" })];
4176
- }), e.startingAfter ? t("div", { staticClass: "d-flex justify-center align-center py-3" }, [t(Lt, { attrs: { color: "primary", depressed: "", disabled: e.isPollingHotelOffers || !e.startingAfter, loading: e.isPollingHotelOffers }, on: { click: e.onSeeMoreClick } }, [e._v(" " + e._s(e.$t("HotelOfferList.showMore")) + " ")])], 1) : e._e()]], 2)], 1), e.parsedFeatures.TermsAndConditionsFooter ? t("TermsAndConditions", { attrs: { theme: "light" } }) : e._e()], 1);
4177
- }, Vc = [], jc = /* @__PURE__ */ Pt(
4178
- Hc,
4179
- Gc,
4180
- Vc,
4181
- !1,
4182
- null,
4183
- null
4184
- );
4185
- const gu = jc.exports;
4186
- export {
4187
- gu as H,
4188
- Zs as a,
4189
- er as h
4190
- };
4191
- //# sourceMappingURL=revolugo.hotelofferlist.D-RL29DF.min.js.map