@walkeros/walker.js 0.5.1-next.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/__tests__/setup.d.ts +3 -0
- package/dist/__tests__/setup.d.ts.map +1 -0
- package/dist/__tests__/setup.js +148 -0
- package/dist/__tests__/setup.js.map +1 -0
- package/dist/destination.d.ts +3 -0
- package/dist/destination.d.ts.map +1 -0
- package/dist/destination.js +28 -0
- package/dist/destination.js.map +1 -0
- package/dist/dev.d.ts +6 -0
- package/dist/dev.d.ts.map +1 -0
- package/dist/dev.js +37 -0
- package/dist/dev.js.map +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.es5.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/types/index.d.ts +22 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/walker.js +1 -1
- package/dist/walkerjs.d.ts +2 -0
- package/dist/walkerjs.d.ts.map +1 -0
- package/dist/walkerjs.js +35 -0
- package/dist/walkerjs.js.map +1 -0
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @walkeros/walker.js
|
|
2
2
|
|
|
3
|
+
## 0.0.0-next-20251219153324
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [5163b01]
|
|
8
|
+
- @walkeros/core@0.0.0-next-20251219153324
|
|
9
|
+
- @walkeros/collector@0.0.0-next-20251219153324
|
|
10
|
+
- @walkeros/web-core@0.0.0-next-20251219153324
|
|
11
|
+
- @walkeros/web-source-datalayer@0.0.0-next-20251219153324
|
|
12
|
+
- @walkeros/web-source-browser@0.0.0-next-20251219153324
|
|
13
|
+
|
|
3
14
|
## 0.5.1-next.0
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/__tests__/setup.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,aAAa,0BAAY,CAAC;AAyKhC,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
// Browser environment setup for walker.js tests
|
|
2
|
+
// Based on @walkeros/jest/web.setup.ts
|
|
3
|
+
const mockDataLayer = jest.fn();
|
|
4
|
+
global.beforeEach(() => {
|
|
5
|
+
jest.useFakeTimers();
|
|
6
|
+
// Mocks
|
|
7
|
+
jest.clearAllMocks();
|
|
8
|
+
jest.resetModules();
|
|
9
|
+
// Reset DOM with event listeners etc.
|
|
10
|
+
document.getElementsByTagName('html')[0].innerHTML = '';
|
|
11
|
+
document.body = document.body.cloneNode();
|
|
12
|
+
// elbLayer and dataLayer
|
|
13
|
+
const w = window;
|
|
14
|
+
w.elbLayer = undefined;
|
|
15
|
+
w.dataLayer = [];
|
|
16
|
+
w.dataLayer.push = mockDataLayer;
|
|
17
|
+
// Performance API - mock the method that was causing test failures
|
|
18
|
+
global.performance.getEntriesByType = jest
|
|
19
|
+
.fn()
|
|
20
|
+
.mockReturnValue([{ type: 'navigate' }]);
|
|
21
|
+
// Mock IntersectionObserver - required for sourceBrowser visibility tracking
|
|
22
|
+
global.IntersectionObserver = jest.fn().mockImplementation((callback) => ({
|
|
23
|
+
observe: jest.fn(),
|
|
24
|
+
unobserve: jest.fn(),
|
|
25
|
+
disconnect: jest.fn(),
|
|
26
|
+
}));
|
|
27
|
+
// Mock ResizeObserver - might be needed for responsive tracking
|
|
28
|
+
global.ResizeObserver = jest.fn().mockImplementation((callback) => ({
|
|
29
|
+
observe: jest.fn(),
|
|
30
|
+
unobserve: jest.fn(),
|
|
31
|
+
disconnect: jest.fn(),
|
|
32
|
+
}));
|
|
33
|
+
// Mock MutationObserver - needed for DOM change detection
|
|
34
|
+
global.MutationObserver = jest.fn().mockImplementation((callback) => ({
|
|
35
|
+
observe: jest.fn(),
|
|
36
|
+
disconnect: jest.fn(),
|
|
37
|
+
takeRecords: jest.fn(),
|
|
38
|
+
}));
|
|
39
|
+
// Mock document.currentScript for auto-init tests
|
|
40
|
+
Object.defineProperty(document, 'currentScript', {
|
|
41
|
+
value: null,
|
|
42
|
+
writable: true,
|
|
43
|
+
});
|
|
44
|
+
// Mock document properties
|
|
45
|
+
Object.defineProperty(document, 'title', {
|
|
46
|
+
value: 'Test Page',
|
|
47
|
+
writable: true,
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(document, 'referrer', {
|
|
50
|
+
value: '',
|
|
51
|
+
writable: true,
|
|
52
|
+
});
|
|
53
|
+
Object.defineProperty(document, 'readyState', {
|
|
54
|
+
value: 'complete',
|
|
55
|
+
writable: true,
|
|
56
|
+
});
|
|
57
|
+
// Mock navigator
|
|
58
|
+
Object.defineProperty(window, 'navigator', {
|
|
59
|
+
value: {
|
|
60
|
+
userAgent: 'Mozilla/5.0 (Node.js jsdom test environment)',
|
|
61
|
+
language: 'en-US',
|
|
62
|
+
platform: 'linux',
|
|
63
|
+
},
|
|
64
|
+
writable: true,
|
|
65
|
+
});
|
|
66
|
+
// Mock screen
|
|
67
|
+
Object.defineProperty(window, 'screen', {
|
|
68
|
+
value: {
|
|
69
|
+
width: 1920,
|
|
70
|
+
height: 1080,
|
|
71
|
+
},
|
|
72
|
+
writable: true,
|
|
73
|
+
});
|
|
74
|
+
// Mock element positioning methods - required for visibility detection
|
|
75
|
+
Element.prototype.getBoundingClientRect = jest.fn(() => ({
|
|
76
|
+
x: 0,
|
|
77
|
+
y: 0,
|
|
78
|
+
width: 100,
|
|
79
|
+
height: 100,
|
|
80
|
+
top: 0,
|
|
81
|
+
left: 0,
|
|
82
|
+
bottom: 100,
|
|
83
|
+
right: 100,
|
|
84
|
+
toJSON: jest.fn(),
|
|
85
|
+
}));
|
|
86
|
+
// Mock element offset properties
|
|
87
|
+
Object.defineProperties(Element.prototype, {
|
|
88
|
+
offsetTop: { get: () => 0, configurable: true },
|
|
89
|
+
offsetLeft: { get: () => 0, configurable: true },
|
|
90
|
+
offsetWidth: { get: () => 100, configurable: true },
|
|
91
|
+
offsetHeight: { get: () => 100, configurable: true },
|
|
92
|
+
clientWidth: { get: () => 100, configurable: true },
|
|
93
|
+
clientHeight: { get: () => 100, configurable: true },
|
|
94
|
+
});
|
|
95
|
+
// Mock getComputedStyle - required for element styling calculations
|
|
96
|
+
global.getComputedStyle = jest.fn().mockImplementation(() => ({
|
|
97
|
+
getPropertyValue: jest.fn().mockReturnValue(''),
|
|
98
|
+
width: '100px',
|
|
99
|
+
height: '100px',
|
|
100
|
+
display: 'block',
|
|
101
|
+
visibility: 'visible',
|
|
102
|
+
}));
|
|
103
|
+
// Mock matchMedia - might be needed for responsive features
|
|
104
|
+
Object.defineProperty(window, 'matchMedia', {
|
|
105
|
+
writable: true,
|
|
106
|
+
value: jest.fn().mockImplementation((query) => ({
|
|
107
|
+
matches: false,
|
|
108
|
+
media: query,
|
|
109
|
+
onchange: null,
|
|
110
|
+
addListener: jest.fn(),
|
|
111
|
+
removeListener: jest.fn(),
|
|
112
|
+
addEventListener: jest.fn(),
|
|
113
|
+
removeEventListener: jest.fn(),
|
|
114
|
+
dispatchEvent: jest.fn(),
|
|
115
|
+
})),
|
|
116
|
+
});
|
|
117
|
+
// Mock localStorage and sessionStorage - required for browser source
|
|
118
|
+
const mockStorage = {
|
|
119
|
+
getItem: jest.fn(),
|
|
120
|
+
setItem: jest.fn(),
|
|
121
|
+
removeItem: jest.fn(),
|
|
122
|
+
clear: jest.fn(),
|
|
123
|
+
key: jest.fn(),
|
|
124
|
+
length: 0,
|
|
125
|
+
};
|
|
126
|
+
Object.defineProperty(window, 'localStorage', {
|
|
127
|
+
value: mockStorage,
|
|
128
|
+
writable: true,
|
|
129
|
+
});
|
|
130
|
+
Object.defineProperty(window, 'sessionStorage', {
|
|
131
|
+
value: mockStorage,
|
|
132
|
+
writable: true,
|
|
133
|
+
});
|
|
134
|
+
// Mock requestAnimationFrame and cancelAnimationFrame
|
|
135
|
+
global.requestAnimationFrame = jest.fn((cb) => setTimeout(cb, 0));
|
|
136
|
+
global.cancelAnimationFrame = jest.fn((id) => clearTimeout(id));
|
|
137
|
+
// Mock requestIdleCallback if it exists
|
|
138
|
+
if (typeof global.requestIdleCallback === 'undefined') {
|
|
139
|
+
global.requestIdleCallback = jest.fn((cb) => setTimeout(cb, 0));
|
|
140
|
+
global.cancelIdleCallback = jest.fn((id) => clearTimeout(id));
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
global.afterEach(() => {
|
|
144
|
+
jest.runOnlyPendingTimers();
|
|
145
|
+
jest.useRealTimers();
|
|
146
|
+
});
|
|
147
|
+
export { mockDataLayer };
|
|
148
|
+
//# sourceMappingURL=setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/__tests__/setup.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,uCAAuC;AAEvC,MAAM,aAAa,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AAEhC,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE;IACrB,IAAI,CAAC,aAAa,EAAE,CAAC;IAErB,QAAQ;IACR,IAAI,CAAC,aAAa,EAAE,CAAC;IACrB,IAAI,CAAC,YAAY,EAAE,CAAC;IAEpB,sCAAsC;IACtC,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,GAAG,EAAE,CAAC;IACxD,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAiB,CAAC;IAEzD,yBAAyB;IACzB,MAAM,CAAC,GAAG,MAAwD,CAAC;IACnE,CAAC,CAAC,QAAQ,GAAG,SAAS,CAAC;IACvB,CAAC,CAAC,SAAS,GAAG,EAAE,CAAC;IAChB,CAAC,CAAC,SAAuB,CAAC,IAAI,GAAG,aAAa,CAAC;IAEhD,mEAAmE;IACnE,MAAM,CAAC,WAAW,CAAC,gBAAgB,GAAG,IAAI;SACvC,EAAE,EAAE;SACJ,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;IAE3C,6EAA6E;IAC7E,MAAM,CAAC,oBAAoB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QACxE,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE;QAClB,SAAS,EAAE,IAAI,CAAC,EAAE,EAAE;QACpB,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE;KACtB,CAAC,CAAC,CAAC;IAEJ,gEAAgE;IAChE,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAClE,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE;QAClB,SAAS,EAAE,IAAI,CAAC,EAAE,EAAE;QACpB,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE;KACtB,CAAC,CAAC,CAAC;IAEJ,0DAA0D;IAC1D,MAAM,CAAC,gBAAgB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QACpE,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE;QAClB,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE;QACrB,WAAW,EAAE,IAAI,CAAC,EAAE,EAAE;KACvB,CAAC,CAAC,CAAC;IAEJ,kDAAkD;IAClD,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,eAAe,EAAE;QAC/C,KAAK,EAAE,IAAI;QACX,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IAEH,2BAA2B;IAC3B,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE;QACvC,KAAK,EAAE,WAAW;QAClB,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IAEH,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,UAAU,EAAE;QAC1C,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IAEH,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,YAAY,EAAE;QAC5C,KAAK,EAAE,UAAU;QACjB,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IAEH,iBAAiB;IACjB,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE;QACzC,KAAK,EAAE;YACL,SAAS,EAAE,8CAA8C;YACzD,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE,OAAO;SAClB;QACD,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IAEH,cAAc;IACd,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE;QACtC,KAAK,EAAE;YACL,KAAK,EAAE,IAAI;YACX,MAAM,EAAE,IAAI;SACb;QACD,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IAEH,uEAAuE;IACvE,OAAO,CAAC,SAAS,CAAC,qBAAqB,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;QACvD,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,CAAC;QACJ,KAAK,EAAE,GAAG;QACV,MAAM,EAAE,GAAG;QACX,GAAG,EAAE,CAAC;QACN,IAAI,EAAE,CAAC;QACP,MAAM,EAAE,GAAG;QACX,KAAK,EAAE,GAAG;QACV,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE;KAClB,CAAC,CAAC,CAAC;IAEJ,iCAAiC;IACjC,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,SAAS,EAAE;QACzC,SAAS,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE;QAC/C,UAAU,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE;QAChD,WAAW,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE;QACnD,YAAY,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE;QACpD,WAAW,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE;QACnD,YAAY,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE;KACrD,CAAC,CAAC;IAEH,oEAAoE;IACpE,MAAM,CAAC,gBAAgB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,CAAC;QAC5D,gBAAgB,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC;QAC/C,KAAK,EAAE,OAAO;QACd,MAAM,EAAE,OAAO;QACf,OAAO,EAAE,OAAO;QAChB,UAAU,EAAE,SAAS;KACtB,CAAC,CAAC,CAAC;IAEJ,4DAA4D;IAC5D,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,YAAY,EAAE;QAC1C,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAC9C,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,KAAK;YACZ,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,IAAI,CAAC,EAAE,EAAE;YACtB,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE;YACzB,gBAAgB,EAAE,IAAI,CAAC,EAAE,EAAE;YAC3B,mBAAmB,EAAE,IAAI,CAAC,EAAE,EAAE;YAC9B,aAAa,EAAE,IAAI,CAAC,EAAE,EAAE;SACzB,CAAC,CAAC;KACJ,CAAC,CAAC;IAEH,qEAAqE;IACrE,MAAM,WAAW,GAAG;QAClB,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE;QAClB,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE;QAClB,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE;QACrB,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE;QAChB,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE;QACd,MAAM,EAAE,CAAC;KACV,CAAC;IAEF,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,cAAc,EAAE;QAC5C,KAAK,EAAE,WAAW;QAClB,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IAEH,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,gBAAgB,EAAE;QAC9C,KAAK,EAAE,WAAW;QAClB,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IAEH,sDAAsD;IACtD,MAAM,CAAC,qBAAqB,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IAClE,MAAM,CAAC,oBAAoB,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC;IAEhE,wCAAwC;IACxC,IAAI,OAAO,MAAM,CAAC,mBAAmB,KAAK,WAAW,EAAE,CAAC;QACtD,MAAM,CAAC,mBAAmB,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;QAChE,MAAM,CAAC,kBAAkB,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC;IAChE,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE;IACpB,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAC5B,IAAI,CAAC,aAAa,EAAE,CAAC;AACvB,CAAC,CAAC,CAAC;AAEH,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"destination.d.ts","sourceRoot":"","sources":["../src/destination.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIlD,wBAAgB,oBAAoB,IAAI,WAAW,CAAC,QAAQ,CA6B3D"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { isObject } from '@walkeros/core';
|
|
2
|
+
export function dataLayerDestination() {
|
|
3
|
+
window.dataLayer = window.dataLayer || [];
|
|
4
|
+
const dataLayerPush = (event) => {
|
|
5
|
+
// Do not process events from dataLayer source
|
|
6
|
+
if (isObject(event) &&
|
|
7
|
+
isObject(event.source) &&
|
|
8
|
+
String(event.source.type).includes('dataLayer'))
|
|
9
|
+
return;
|
|
10
|
+
window.dataLayer.push(event);
|
|
11
|
+
};
|
|
12
|
+
const destination = {
|
|
13
|
+
type: 'dataLayer',
|
|
14
|
+
config: {},
|
|
15
|
+
push: (event, context) => {
|
|
16
|
+
dataLayerPush(context.data || event);
|
|
17
|
+
},
|
|
18
|
+
pushBatch: (batch) => {
|
|
19
|
+
dataLayerPush({
|
|
20
|
+
name: 'batch',
|
|
21
|
+
batched_event: batch.key,
|
|
22
|
+
events: batch.data.length ? batch.data : batch.events,
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
return destination;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=destination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"destination.js","sourceRoot":"","sources":["../src/destination.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,UAAU,oBAAoB;IAClC,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC;IAC1C,MAAM,aAAa,GAAG,CAAC,KAAc,EAAE,EAAE;QACvC,8CAA8C;QAC9C,IACE,QAAQ,CAAC,KAAK,CAAC;YACf,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC;YACtB,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC;YAE/C,OAAO;QAER,MAAM,CAAC,SAAwB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC,CAAC;IACF,MAAM,WAAW,GAAyB;QACxC,IAAI,EAAE,WAAW;QACjB,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YACvB,aAAa,CAAC,OAAO,CAAC,IAAI,IAAI,KAAK,CAAC,CAAC;QACvC,CAAC;QACD,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;YACnB,aAAa,CAAC;gBACZ,IAAI,EAAE,OAAO;gBACb,aAAa,EAAE,KAAK,CAAC,GAAG;gBACxB,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM;aACtD,CAAC,CAAC;QACL,CAAC;KACF,CAAC;IAEF,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
package/dist/dev.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type JSONSchema } from '@walkeros/core/dev';
|
|
2
|
+
export declare const settings: JSONSchema;
|
|
3
|
+
export declare const browserConfig: JSONSchema;
|
|
4
|
+
export declare const dataLayerConfig: JSONSchema;
|
|
5
|
+
export declare const collectorConfig: JSONSchema;
|
|
6
|
+
//# sourceMappingURL=dev.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../src/dev.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,UAAU,EAChB,MAAM,oBAAoB,CAAC;AAoC5B,eAAO,MAAM,QAAQ,EAAE,UAAsC,CAAC;AAC9D,eAAO,MAAM,aAAa,EAAE,UAAoC,CAAC;AACjE,eAAO,MAAM,eAAe,EAAE,UAAsC,CAAC;AACrE,eAAO,MAAM,eAAe,EAAE,UACqB,CAAC"}
|
package/dist/dev.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { schemas as coreSchemas, z, zodToSchema, } from '@walkeros/core/dev';
|
|
2
|
+
import { schemas as browserSchemas } from '@walkeros/web-source-browser/dev';
|
|
3
|
+
import { schemas as dataLayerSchemas } from '@walkeros/web-source-datalayer/dev';
|
|
4
|
+
/**
|
|
5
|
+
* Walker.js Config schema
|
|
6
|
+
*
|
|
7
|
+
* Matches the Config interface in types/index.ts
|
|
8
|
+
*/
|
|
9
|
+
const ConfigSchema = z.object({
|
|
10
|
+
collector: z
|
|
11
|
+
.any()
|
|
12
|
+
.optional()
|
|
13
|
+
.describe('Collector configuration (Collector.InitConfig)'),
|
|
14
|
+
browser: z
|
|
15
|
+
.any()
|
|
16
|
+
.optional()
|
|
17
|
+
.describe('Browser source configuration (Partial<SourceBrowser.Settings>)'),
|
|
18
|
+
dataLayer: z
|
|
19
|
+
.union([z.boolean(), z.any()])
|
|
20
|
+
.optional()
|
|
21
|
+
.describe('DataLayer configuration (boolean | Partial<SourceDataLayer.Settings>)'),
|
|
22
|
+
elb: z
|
|
23
|
+
.string()
|
|
24
|
+
.optional()
|
|
25
|
+
.describe('Name for the global elb function (default: "elb")'),
|
|
26
|
+
name: z.string().optional().describe('Name for the global instance'),
|
|
27
|
+
run: z
|
|
28
|
+
.boolean()
|
|
29
|
+
.optional()
|
|
30
|
+
.describe('Auto-run on initialization (default: true)'),
|
|
31
|
+
});
|
|
32
|
+
// Named exports for MDX PropertyTable usage
|
|
33
|
+
export const settings = zodToSchema(ConfigSchema);
|
|
34
|
+
export const browserConfig = browserSchemas.settings;
|
|
35
|
+
export const dataLayerConfig = dataLayerSchemas.settings;
|
|
36
|
+
export const collectorConfig = coreSchemas.CollectorSchemas.initConfigJsonSchema;
|
|
37
|
+
//# sourceMappingURL=dev.js.map
|
package/dist/dev.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../src/dev.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,IAAI,WAAW,EACtB,CAAC,EACD,WAAW,GAEZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAEjF;;;;GAIG;AACH,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,SAAS,EAAE,CAAC;SACT,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,QAAQ,CAAC,gDAAgD,CAAC;IAC7D,OAAO,EAAE,CAAC;SACP,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,QAAQ,CAAC,gEAAgE,CAAC;IAC7E,SAAS,EAAE,CAAC;SACT,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;SAC7B,QAAQ,EAAE;SACV,QAAQ,CACP,uEAAuE,CACxE;IACH,GAAG,EAAE,CAAC;SACH,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,mDAAmD,CAAC;IAChE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;IACpE,GAAG,EAAE,CAAC;SACH,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,QAAQ,CAAC,4CAA4C,CAAC;CAC1D,CAAC,CAAC;AAEH,4CAA4C;AAC5C,MAAM,CAAC,MAAM,QAAQ,GAAe,WAAW,CAAC,YAAY,CAAC,CAAC;AAC9D,MAAM,CAAC,MAAM,aAAa,GAAe,cAAc,CAAC,QAAQ,CAAC;AACjE,MAAM,CAAC,MAAM,eAAe,GAAe,gBAAgB,CAAC,QAAQ,CAAC;AACrE,MAAM,CAAC,MAAM,eAAe,GAC1B,WAAW,CAAC,gBAAgB,CAAC,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAIhD,OAAO,EAEL,YAAY,EACZ,SAAS,EACT,UAAU,EAEX,MAAM,8BAA8B,CAAC;AAKtC,OAAO,KAAK,QAAQ,MAAM,SAAS,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;AAG/C,wBAAsB,cAAc,CAAC,MAAM,GAAE,MAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CA4D3E;AAGD,eAAe,cAAc,CAAC"}
|
package/dist/index.es5.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _array_like_to_array(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _array_with_holes(e){if(Array.isArray(e))return e}function _array_without_holes(e){if(Array.isArray(e))return _array_like_to_array(e)}function asyncGeneratorStep(e,t,n,r,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(r,o)}function _async_to_generator(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){asyncGeneratorStep(a,r,o,i,c,"next",e)}function c(e){asyncGeneratorStep(a,r,o,i,c,"throw",e)}i(void 0)})}}function _define_property(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _instanceof(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function _iterable_to_array(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _iterable_to_array_limit(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,c=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(c)throw o}}return a}}function _non_iterable_rest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _non_iterable_spread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _object_spread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){_define_property(e,t,n[t])})}return e}function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _object_spread_props(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function _object_without_properties(e,t){if(null==e)return{};var n,r,o,a={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(n=Reflect.ownKeys(e),o=0;o<n.length;o++)r=n[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r]);return a}if(a=_object_without_properties_loose(e,t),Object.getOwnPropertySymbols)for(n=Object.getOwnPropertySymbols(e),o=0;o<n.length;o++)r=n[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r]);return a}function _object_without_properties_loose(e,t){if(null==e)return{};var n,r,o={},a=Object.getOwnPropertyNames(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n]);return o}function _sliced_to_array(e,t){return _array_with_holes(e)||_iterable_to_array_limit(e,t)||_unsupported_iterable_to_array(e,t)||_non_iterable_rest()}function _to_array(e){return _array_with_holes(e)||_iterable_to_array(e)||_unsupported_iterable_to_array(e)||_non_iterable_rest()}function _to_consumable_array(e){return _array_without_holes(e)||_iterable_to_array(e)||_unsupported_iterable_to_array(e)||_non_iterable_spread()}function _type_of(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _unsupported_iterable_to_array(e,t){if(e){if("string"==typeof e)return _array_like_to_array(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_array_like_to_array(e,t):void 0}}function _ts_generator(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(i,"next",{value:s(0)}),c(i,"throw",{value:s(1)}),c(i,"return",{value:s(2)}),"function"==typeof Symbol&&c(i,Symbol.iterator,{value:function(){return this}}),i;function s(c){return function(s){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}}function _ts_values(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}var Walkerjs=function(){var e=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n=_object_spread({},He,n);var r=Object.entries(t).reduce(function(t,r){var o=_sliced_to_array(r,2),a=o[0],i=o[1],c=e[a];return n.merge&&Array.isArray(c)&&Array.isArray(i)?t[a]=i.reduce(function(e,t){return e.includes(t)?e:_to_consumable_array(e).concat([t])},_to_consumable_array(c)):(n.extend||a in e)&&(t[a]=i),t},{});return n.shallow?_object_spread({},e,r):(Object.assign(e,r),e)},t=function(e){return Array.isArray(e)},n=function(e){return void 0!==e},r=function(e){return"object"==(void 0===e?"undefined":_type_of(e))&&null!==e&&!t(e)&&"[object Object]"===Object.prototype.toString.call(e)},o=function(e){return"string"==typeof e},a=function(e,t,n){if(!r(e))return e;for(var o=Je(e),a=t.split("."),i=o,c=0;c<a.length;c++){var s=a[c];c===a.length-1?i[s]=n:(s in i&&"object"==_type_of(i[s])&&null!==i[s]||(i[s]={}),i=i[s])}return o},i=function(e){var t=_object_spread({},arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),n={},r=void 0===e;return Object.keys(t).forEach(function(o){t[o]&&(n[o]=!0,e&&e[o]&&(r=!0))}),!!r&&n},c=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:6,t="";t.length<e;)t+=(36*Math.random()|0).toString(36);return t},s=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=null,a=!1;return function(){for(var i=arguments.length,c=new Array(i),s=0;s<i;s++)c[s]=arguments[s];return new Promise(function(i){var s=r&&!a;o&&clearTimeout(o),o=setTimeout(function(){o=null,r&&!a||(t=e.apply(void 0,_to_consumable_array(c)),i(t))},n),s&&(a=!0,t=e.apply(void 0,_to_consumable_array(c)),i(t))})}},u=function(e){return{message:e.message,name:e.name,stack:e.stack,cause:e.cause}},l=function(e,t){var n,r={};return _instanceof(e,Error)?(n=e.message,r.error=u(e)):n=e,void 0!==t&&(_instanceof(t,Error)?r.error=u(t):"object"==(void 0===t?"undefined":_type_of(t))&&null!==t?"error"in(r=_object_spread({},r,t))&&_instanceof(r.error,Error)&&(r.error=u(r.error)):r.value=t),{message:n,context:r}},f=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Ve({level:void 0!==t.level?(e=t.level,"string"==typeof e?Ke[e]:e):0,handler:t.handler,scope:[]})},d=function(e){return $e(e)?e:void 0},_=function(e,t,n){return function(){for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];try{return e.apply(void 0,_to_consumable_array(o))}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}},g=function(e,t,n){return function(){for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];return _async_to_generator(function(){var r;return _ts_generator(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,4,6]),[4,e.apply(void 0,_to_consumable_array(o))];case 1:case 3:return[2,a.sent()];case 2:return r=a.sent(),t?[4,t(r)]:[2];case 4:return[4,null==n?void 0:n()];case 5:return a.sent(),[7];case 6:return[2]}})})()}},v=function(e,n){return _async_to_generator(function(){var r,o,a,i,c,s,u,l,f,d;return _ts_generator(this,function(_){return o=_sliced_to_array((e.name||"").split(" "),2),a=o[0],i=o[1],n&&a&&i?(s="",l=i,f=function(n){if(n)return(n=t(n)?n:[n]).find(function(t){return!t.condition||t.condition(e)})},n[u=a]||(u="*"),[2,((d=n[u])&&(d[l]||(l="*"),c=f(d[l])),c||(u="*",l="*",c=f(null===(r=n[u])||void 0===r?void 0:r[l])),c&&(s="".concat(u," ").concat(l)),{eventMapping:c,mappingKey:s})]):[2,{}]})})()},p=function(e){return _async_to_generator(function(e){var o,a,i,c,s,u,l,f,d,_,v,p,y,m=arguments;return _ts_generator(this,function(h){switch(h.label){case 0:if(o=m.length>1&&void 0!==m[1]?m[1]:{},a=m.length>2&&void 0!==m[2]?m[2]:{},!n(e))return[2];c=r(e)&&e.consent||a.consent||(null===(i=a.collector)||void 0===i?void 0:i.consent),s=t(o)?o:[o],u=!0,l=!1,f=void 0,h.label=1;case 1:h.trys.push([1,6,7,8]),d=s[Symbol.iterator](),h.label=2;case 2:return(u=(_=d.next()).done)?[3,5]:(v=_.value,[4,g(Qe)(e,v,_object_spread_props(_object_spread({},a),{consent:c}))]);case 3:if(p=h.sent(),n(p))return[2,p];h.label=4;case 4:return u=!0,[3,2];case 5:return[3,8];case 6:return y=h.sent(),l=!0,f=y,[3,8];case 7:try{u||null==d.return||d.return()}finally{if(l)throw f}return[7];case 8:return[2]}})}).apply(this,arguments)},y=function(t,n,o){return _async_to_generator(function(){var i,c,s,u,l,f,d;return _ts_generator(this,function(_){switch(_.label){case 0:return n.policy?[4,Promise.all(Object.entries(n.policy).map(function(e){var n=_sliced_to_array(e,2),r=n[0],i=n[1];return _async_to_generator(function(){var e;return _ts_generator(this,function(n){switch(n.label){case 0:return[4,p(t,i,{collector:o})];case 1:return e=n.sent(),t=a(t,r,e),[2]}})})()}))]:[3,2];case 1:_.sent(),_.label=2;case 2:return[4,v(t,n.mapping)];case 3:return i=_.sent(),c=i.eventMapping,s=i.mappingKey,(null==c?void 0:c.policy)?[4,Promise.all(Object.entries(c.policy).map(function(e){var n=_sliced_to_array(e,2),r=n[0],i=n[1];return _async_to_generator(function(){var e;return _ts_generator(this,function(n){switch(n.label){case 0:return[4,p(t,i,{collector:o})];case 1:return e=n.sent(),t=a(t,r,e),[2]}})})()}))]:[3,5];case 4:_.sent(),_.label=5;case 5:return(l=n.data)?[4,p(t,n.data,{collector:o})]:[3,7];case 6:l=_.sent(),_.label=7;case 7:return u=l,c?c.ignore?[2,{event:t,data:u,mapping:c,mappingKey:s,ignore:!0}]:(c.name&&(t.name=c.name),c.data?(d=c.data)?[4,p(t,c.data,{collector:o})]:[3,9]:[3,10]):[3,10];case 8:d=_.sent(),_.label=9;case 9:f=d,u=r(u)&&r(f)?e(u,f):f,_.label=10;case 10:return[2,{event:t,data:u,mapping:c,mappingKey:s,ignore:!1}]}})})()},m=function(e,t,n){return function(){for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];var i,c="post"+t,s=n["pre"+t],u=n[c];return i=s?s.apply(void 0,[{fn:e}].concat(_to_consumable_array(o))):e.apply(void 0,_to_consumable_array(o)),u&&(i=u.apply(void 0,[{fn:e,result:i}].concat(_to_consumable_array(o)))),i}},h=function(e){return!0===e?tt:e},b=function(e,t,n){return _async_to_generator(function(){var r,o,a,i,s,u,l,f,d;return _ts_generator(this,function(_){if(r=t.code,o=t.config,a=void 0===o?{}:o,i=t.env,s=void 0===i?{}:i,u=n||a||{init:!1},l=h(r),f=_object_spread_props(_object_spread({},l),{config:u,env:E(l.env,s)}),!(d=f.config.id))do{d=c(4)}while(e.destinations[d]);return[2,(e.destinations[d]=f,!1!==f.config.queue&&(f.queue=_to_consumable_array(e.queue)),w(e,void 0,_define_property({},d,f)))]})})()},w=function(t,n,r){return _async_to_generator(function(){var o,a,c,s,u,l,f,d,_,v,p,y,m,h,b,w;return _ts_generator(this,function(S){switch(S.label){case 0:return o=t.allowed,a=t.consent,c=t.globals,s=t.user,o?(n&&t.queue.push(n),r||(r=t.destinations),[4,Promise.all(Object.entries(r||{}).map(function(r){var o=_sliced_to_array(r,2),u=o[0],l=o[1];return _async_to_generator(function(){var r,o,f,d,_;return _ts_generator(this,function(v){switch(v.label){case 0:return r=(l.queue||[]).map(function(e){return _object_spread_props(_object_spread({},e),{consent:a})}),l.queue=[],n&&(o=Je(n),r.push(o)),r.length?(f=[],d=r.filter(function(e){var t=i(l.config.consent,a,e.consent);return!t||(e.consent=t,f.push(e),!1)}),l.queue.concat(d),f.length?[4,g(j)(t,l)]:[2,{id:u,destination:l,queue:r}]):[2,{id:u,destination:l,skipped:!0}];case 1:return v.sent()?(_=!1,l.dlq||(l.dlq=[]),[4,Promise.all(f.map(function(n){return _async_to_generator(function(){return _ts_generator(this,function(r){switch(r.label){case 0:return n.globals=e(c,n.globals),n.user=e(s,n.user),[4,g(k,function(e){var r=l.type||"unknown";return t.logger.scope(r).error("Push failed",{error:e,event:n.name}),_=!0,l.dlq.push([n,e]),!1})(t,l,n)];case 1:return[2,(r.sent(),n)]}})})()}))]):[2,{id:u,destination:l,queue:r}];case 2:return[2,(v.sent(),{id:u,destination:l,error:_})]}})})()}))]):[2,O({ok:!1})];case 1:u=S.sent(),l=[],f=[],d=[],_=!0,v=!1,p=void 0;try{for(y=u[Symbol.iterator]();!(_=(m=y.next()).done);_=!0)(h=m.value).skipped||(b=h.destination,w={id:h.id,destination:b},h.error?d.push(w):h.queue&&h.queue.length?(b.queue=(b.queue||[]).concat(h.queue),f.push(w)):l.push(w))}catch(e){v=!0,p=e}finally{try{_||null==y.return||y.return()}finally{if(v)throw p}}return[2,O({ok:!d.length,event:n,successful:l,queued:f,failed:d})]}})})()},j=function(e,t){return _async_to_generator(function(){var n,r,o,a;return _ts_generator(this,function(i){switch(i.label){case 0:return!t.init||t.config.init?[3,2]:(n=t.type||"unknown",r=e.logger.scope(n),o={collector:e,config:t.config,env:E(t.env,t.config.env),logger:r},r.debug("init"),[4,m(t.init,"DestinationInit",e.hooks)(o)]);case 1:if(!1===(a=i.sent()))return[2,a];t.config=_object_spread_props(_object_spread({},a||t.config),{init:!0}),r.debug("init done"),i.label=2;case 2:return[2,!0]}})})()},k=function(e,t,r){return _async_to_generator(function(){var o,a,i,c,u,l,f,d,_;return _ts_generator(this,function(g){switch(g.label){case 0:return o=t.config,[4,y(r,o,e)];case 1:return(a=g.sent()).ignore?[2,!1]:(i=t.type||"unknown",c=e.logger.scope(i),u={collector:e,config:o,data:a.data,mapping:a.mapping,env:E(t.env,o.env),logger:c},l=a.mapping,f=a.mappingKey||"* *",(null==l?void 0:l.batch)&&t.pushBatch?(t.batches=t.batches||{},t.batches[f]||(d={key:f,events:[],data:[]},t.batches[f]={batched:d,batchFn:s(function(){var n=t.batches[f].batched,r={collector:e,config:o,data:void 0,mapping:l,env:E(t.env,o.env),logger:c};c.debug("push batch",{events:n.events.length}),m(t.pushBatch,"DestinationPushBatch",e.hooks)(n,r),c.debug("push batch done"),n.events=[],n.data=[]},l.batch)}),(_=t.batches[f]).batched.events.push(a.event),n(a.data)&&_.batched.data.push(a.data),_.batchFn(),[3,4]):[3,2]);case 2:return c.debug("push",{event:a.event.name}),[4,m(t.push,"DestinationPush",e.hooks)(a.event,u)];case 3:g.sent(),c.debug("push done"),g.label=4;case 4:return[2,!0]}})})()},O=function(t){var n;return e({ok:!(null==t||null===(n=t.failed)||void 0===n?void 0:n.length),successful:[],queued:[],failed:[]},t)},S=function(e){return _async_to_generator(function(e){var t,n,r,o,a,i,c,s,u,l,f,d,_,g,v,p,y,m,b=arguments;return _ts_generator(this,function(e){t=b.length>1&&void 0!==b[1]?b[1]:{},n={},r=!0,o=!1,a=void 0;try{for(i=Object.entries(t)[Symbol.iterator]();!(r=(c=i.next()).done);r=!0)s=_sliced_to_array(c.value,2),u=s[0],l=s[1],f=l.code,d=l.config,_=void 0===d?{}:d,g=l.env,v=void 0===g?{}:g,p=h(f),y=_object_spread({},p.config,_),m=E(p.env,v),n[u]=_object_spread_props(_object_spread({},p),{config:y,env:m})}catch(e){o=!0,a=e}finally{try{r||null==i.return||i.return()}finally{if(o)throw a}}return[2,n]})}).apply(this,arguments)},E=function(e,t){return e||t?t?e&&r(e)&&r(t)?_object_spread({},e,t):t:e:{}},x=function(e,t,n,r){var o,a,i,c,s=n||[];switch(n||(s=e.on[t]||[]),t){case et.Commands.Consent:o=r||e.consent;break;case et.Commands.Session:o=e.session;break;case et.Commands.Ready:case et.Commands.Run:default:o=void 0}if(Object.values(e.sources).forEach(function(e){e.on&&_(e.on)(t,o)}),Object.values(e.destinations).forEach(function(n){if(n.on){var r=n.type||"unknown",a=e.logger.scope(r).scope("on").scope(t),i={collector:e,config:n.config,data:o,env:E(n.env,n.config.env),logger:a};_(n.on)(t,i)}}),s.length)switch(t){case et.Commands.Consent:a=e,i=s,c=r||a.consent,i.forEach(function(e){Object.keys(c).filter(function(t){return t in e}).forEach(function(t){_(e[t])(a,c)})});break;case et.Commands.Ready:case et.Commands.Run:!function(e,t){e.allowed&&t.forEach(function(t){_(t)(e)})}(e,s);break;case et.Commands.Session:!function(e,t){e.session&&t.forEach(function(t){_(t)(e,e.session)})}(e,s)}},C=function(t,n){return _async_to_generator(function(){var r,o,a;return _ts_generator(this,function(i){return r=t.consent,o=!1,a={},[2,(Object.entries(n).forEach(function(e){var t=_sliced_to_array(e,2),n=t[0],r=!!t[1];a[n]=r,o=o||r}),t.consent=e(r,a),x(t,"consent",void 0,a),o?w(t):O({ok:!0}))]})})()},A=function(n,a,i,c){return _async_to_generator(function(){var s,u;return _ts_generator(this,function(l){switch(l.label){case 0:switch(a){case et.Commands.Config:return[3,1];case et.Commands.Consent:return[3,2];case et.Commands.Custom:return[3,5];case et.Commands.Destination:return[3,6];case et.Commands.Globals:return[3,9];case et.Commands.On:return[3,10];case et.Commands.Ready:return[3,11];case et.Commands.Run:return[3,12];case et.Commands.Session:return[3,14];case et.Commands.User:return[3,15]}return[3,16];case 1:return r(i)&&e(n.config,i,{shallow:!1}),[3,16];case 2:return r(i)?[4,C(n,i)]:[3,4];case 3:s=l.sent(),l.label=4;case 4:return[3,16];case 5:return r(i)&&(n.custom=e(n.custom,i)),[3,16];case 6:return u=r(i)&&function(e){return"function"==typeof e}(i.push),u?[4,b(n,{code:i},c)]:[3,8];case 7:u=s=l.sent(),l.label=8;case 8:return[3,16];case 9:return r(i)&&(n.globals=e(n.globals,i)),[3,16];case 10:return o(i)&&function(e,n,r){var o=e.on,a=o[n]||[],i=t(r)?r:[r];i.forEach(function(e){a.push(e)}),o[n]=a,x(e,n,i)}(n,i,c),[3,16];case 11:return x(n,"ready"),[3,16];case 12:return[4,P(n,i)];case 13:return s=l.sent(),[3,16];case 14:return x(n,"session"),[3,16];case 15:r(i)&&e(n.user,i,{shallow:!1}),l.label=16;case 16:return[2,s||{ok:!0,successful:[],queued:[],failed:[]}]}})})()},P=function(t,n){return _async_to_generator(function(){var r;return _ts_generator(this,function(o){switch(o.label){case 0:return t.allowed=!0,t.count=0,t.group=c(),t.timing=Date.now(),n&&(n.consent&&(t.consent=e(t.consent,n.consent)),n.user&&(t.user=e(t.user,n.user)),n.globals&&(t.globals=e(t.config.globalsStatic||{},n.globals)),n.custom&&(t.custom=e(t.custom,n.custom))),Object.values(t.destinations).forEach(function(e){e.queue=[]}),t.queue=[],t.round++,[4,w(t)];case 1:return r=o.sent(),[2,(x(t,"run"),r)]}})})()},L=function(e,t){return m(function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return _async_to_generator(function(){return _ts_generator(this,function(o){switch(o.label){case 0:return[4,g(function(){return _async_to_generator(function(){var o,a,c,s;return _ts_generator(this,function(u){switch(u.label){case 0:return o=n,r.mapping?[4,y(o,r.mapping,e)]:[3,2];case 1:if((a=u.sent()).ignore)return[2,O({ok:!0})];if(r.mapping.consent&&!i(r.mapping.consent,e.consent,a.event.consent))return[2,O({ok:!0})];o=a.event,u.label=2;case 2:return c=t(o),s=function(e,t){if(!t.name)throw new Error("Event name is required");var n=_sliced_to_array(t.name.split(" "),2),r=n[0],o=n[1];if(!r||!o)throw new Error("Event name is invalid");++e.count;var a=t.timestamp,i=void 0===a?Date.now():a,c=t.group,s=void 0===c?e.group:c,u=t.count,l=void 0===u?e.count:u,f=t.name,d=void 0===f?"".concat(r," ").concat(o):f,_=t.data,g=void 0===_?{}:_,v=t.context,p=void 0===v?{}:v,y=t.globals,m=void 0===y?e.globals:y,h=t.custom,b=void 0===h?{}:h,w=t.user,j=void 0===w?e.user:w,k=t.nested,O=void 0===k?[]:k,S=t.consent,E=void 0===S?e.consent:S,x=t.id,C=void 0===x?"".concat(i,"-").concat(s,"-").concat(l):x,A=t.trigger,P=void 0===A?"":A,L=t.entity,R=void 0===L?r:L,q=t.action,I=void 0===q?o:q,U=t.timing,D=void 0===U?0:U,N=t.version,T=void 0===N?{source:e.version,tagging:e.config.tagging||0}:N,W=t.source;return{name:d,data:g,context:p,globals:m,custom:b,user:j,nested:O,consent:E,id:C,trigger:P,entity:R,action:I,timestamp:i,timing:D,group:s,count:l,version:T,source:void 0===W?{type:"collector",id:"",previous_id:""}:W}}(e,c),[4,w(e,s)];case 3:return[2,u.sent()]}})})()},function(){return O({ok:!1})})()];case 1:return[2,o.sent()]}})})()},"Push",e.hooks)},R=function(t){return _async_to_generator(function(){var n,r,o,a,i,c,s;return _ts_generator(this,function(u){switch(u.label){case 0:return o=e({globalsStatic:{},sessionStatic:{},tagging:0,run:!0},t,{merge:!1,extend:!1}),a={level:null===(n=t.logger)||void 0===n?void 0:n.level,handler:null===(r=t.logger)||void 0===r?void 0:r.handler},i=f(a),c=_object_spread({},o.globalsStatic,t.globals),(s={allowed:!1,config:o,consent:t.consent||{},count:0,custom:t.custom||{},destinations:{},globals:c,group:"",hooks:{},logger:i,on:{},queue:[],round:0,session:void 0,timing:Date.now(),user:t.user||{},version:"0.5.0",sources:{},push:void 0,command:void 0}).push=L(s,function(e){return _object_spread({timing:Math.round((Date.now()-s.timing)/10)/100,source:{type:"collector",id:"",previous_id:""}},e)}),s.command=(d=A,m(function(e,t,n){return _async_to_generator(function(){return _ts_generator(this,function(r){switch(r.label){case 0:return[4,g(function(){return _async_to_generator(function(){return _ts_generator(this,function(r){switch(r.label){case 0:return[4,d(l,e,t,n)];case 1:return[2,r.sent()]}})})()},function(){return O({ok:!1})})()];case 1:return[2,r.sent()]}})})()},"Command",(l=s).hooks)),[4,S(0,t.destinations||{})];case 1:return[2,(s.destinations=u.sent(),s)]}var l,d})})()},q=function(e){return _async_to_generator(function(e){var t,n,r,o,a,i,c,s,u,l=arguments;return _ts_generator(this,function(f){switch(f.label){case 0:t=l.length>1&&void 0!==l[1]?l[1]:{},n={},r=!0,o=!1,a=void 0,f.label=1;case 1:f.trys.push([1,6,7,8]),i=function(){var t,r,o,a,i,c,u,l,f,d,_,v,p,y,m;return _ts_generator(this,function(h){switch(h.label){case 0:return t=_sliced_to_array(s.value,2),r=t[0],o=t[1],a=o.code,i=o.config,c=void 0===i?{}:i,u=o.env,l=void 0===u?{}:u,f=o.primary,d=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.push(t,_object_spread_props(_object_spread({},n),{mapping:c}))},_=e.logger.scope("source").scope(r),v=_object_spread({push:d,command:e.command,sources:e.sources,elb:e.sources.elb.push,logger:_},l),[4,g(a)(c,v)];case 1:return(p=h.sent())?(y=p.type||"unknown",m=e.logger.scope(y).scope(r),v.logger=m,f&&(p.config=_object_spread_props(_object_spread({},p.config),{primary:f})),n[r]=p,[2]):[2,"continue"]}})},c=Object.entries(t)[Symbol.iterator](),f.label=2;case 2:return(r=(s=c.next()).done)?[3,5]:[5,_ts_values(i())];case 3:f.sent(),f.label=4;case 4:return r=!0,[3,2];case 5:return[3,8];case 6:return u=f.sent(),o=!0,a=u,[3,8];case 7:try{r||null==c.return||c.return()}finally{if(o)throw a}return[7];case 8:return[2,n]}})}).apply(this,arguments)},I=function(e,t){return(e.getAttribute(t)||"").trim()},U=function(e){var t,n=getComputedStyle(e);if("none"===n.display)return!1;if("visible"!==n.visibility)return!1;if(n.opacity&&Number(n.opacity)<.1)return!1;var r=window.innerHeight,o=e.getBoundingClientRect(),a=o.height,i=o.y,c=i+a,s={x:o.x+e.offsetWidth/2,y:o.y+e.offsetHeight/2};if(a<=r){if(e.offsetWidth+o.width===0||e.offsetHeight+o.height===0)return!1;if(s.x<0)return!1;if(s.x>(document.documentElement.clientWidth||window.innerWidth))return!1;if(s.y<0)return!1;if(s.y>(document.documentElement.clientHeight||window.innerHeight))return!1;t=document.elementFromPoint(s.x,s.y)}else{var u=r/2;if(i<0&&c<u)return!1;if(c>r&&i>u)return!1;t=document.elementFromPoint(s.x,r/2)}if(t)do{if(t===e)return!0}while(t=t.parentElement);return!1},D=function(e,t,n){return!1===n?e:(n||(n=rt),n(e,t,rt))},N=function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Fe.Utils.Storage.Session;function o(e){try{return JSON.parse(e||"")}catch(r){var t=1,n="";return e&&(t=0,n=e),{e:t,v:n}}}switch(r){case Fe.Utils.Storage.Cookie:var a;t=decodeURIComponent((null===(a=document.cookie.split("; ").find(function(t){return t.startsWith(e+"=")}))||void 0===a?void 0:a.split("=")[1])||"");break;case Fe.Utils.Storage.Local:n=o(window.localStorage.getItem(e));break;case Fe.Utils.Storage.Session:n=o(window.sessionStorage.getItem(e))}return n&&(t=n.v,0!=n.e&&n.e<Date.now()&&(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Fe.Utils.Storage.Session;switch(t){case Fe.Utils.Storage.Cookie:T(e,"",0,t);break;case Fe.Utils.Storage.Local:window.localStorage.removeItem(e);break;case Fe.Utils.Storage.Session:window.sessionStorage.removeItem(e)}}(e,r),t="")),function(e){if("true"===e)return!0;if("false"===e)return!1;var t=Number(e);return e==t&&""!==e?t:String(e)}(t||"")},T=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:30,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Fe.Utils.Storage.Session,o=arguments.length>4?arguments[4]:void 0,a={e:Date.now()+6e4*n,v:String(t)},i=JSON.stringify(a);switch(r){case Fe.Utils.Storage.Cookie:t="object"==(void 0===t?"undefined":_type_of(t))?JSON.stringify(t):t;var c="".concat(e,"=").concat(encodeURIComponent(t),"; max-age=").concat(60*n,"; path=/; SameSite=Lax; secure");o&&(c+="; domain="+o),document.cookie=c;break;case Fe.Utils.Storage.Local:window.localStorage.setItem(e,i);break;case Fe.Utils.Storage.Session:window.sessionStorage.setItem(e,i)}return N(e,r)},W=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=Date.now(),n=e.length,r=void 0===n?30:n,o=e.deviceKey,a=void 0===o?"elbDeviceId":o,i=e.deviceStorage,s=void 0===i?"local":i,u=e.deviceAge,l=void 0===u?30:u,f=e.sessionKey,d=void 0===f?"elbSessionId":f,g=e.sessionStorage,v=void 0===g?"local":g,p=e.pulse,y=void 0!==p&&p,m=X(e),h=!1,b=_(function(e,t,n){var r=N(e,n);return r||(r=c(8),T(e,r,1440*t,n)),String(r)})(a,l,s),w=_(function(e,n){var o=JSON.parse(String(N(e,n)));return y||(o.isNew=!1,m.marketing&&(Object.assign(o,m),h=!0),h||o.updated+6e4*r<t?(delete o.id,delete o.referrer,o.start=t,o.count++,o.runs=1,h=!0):o.runs++),o},function(){h=!0})(d,v)||{},j={id:c(12),start:t,isNew:!0,count:1,runs:1},k=Object.assign(j,m,w,{device:b},{isStart:h,storage:!0,updated:t},e.data);return T(d,JSON.stringify(k),2*r,v),k},X=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.isStart||!1,r={isStart:n,storage:!1};if(!1===t.isStart)return r;if(!n&&"navigate"!==_sliced_to_array(performance.getEntriesByType("navigation"),1)[0].type)return r;var o=new URL(t.url||window.location.href),a=t.referrer||document.referrer,i=a&&new URL(a).hostname,s=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="clickId",o={},a={utm_campaign:"campaign",utm_content:"content",utm_medium:"medium",utm_source:"source",utm_term:"term",dclid:r,fbclid:r,gclid:r,msclkid:r,ttclid:r,twclid:r,igshid:r,sclid:r};return Object.entries(e(a,n)).forEach(function(e){var n=_sliced_to_array(e,2),a=n[0],i=n[1],c=t.searchParams.get(a);c&&(i===r&&(i=a,o[r]=a),o[i]=c)}),o}(o,t.parameters);if(Object.keys(s).length&&(s.marketing||(s.marketing=!0),n=!0),!n){var u=t.domains||[];u.push(o.hostname),n=!u.includes(i)}return n?Object.assign({isStart:n,storage:!1,start:Date.now(),id:c(12),referrer:i},s,t.data):r},B=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n=_object_spread({},st,n);var r=Object.entries(t).reduce(function(t,r){var o=_sliced_to_array(r,2),a=o[0],i=o[1],c=e[a];return n.merge&&Array.isArray(c)&&Array.isArray(i)?t[a]=i.reduce(function(e,t){return e.includes(t)?e:_to_consumable_array(e).concat([t])},_to_consumable_array(c)):(n.extend||a in e)&&(t[a]=i),t},{});return n.shallow?_object_spread({},e,r):(Object.assign(e,r),e)},G=function(e){return Array.isArray(e)},M=function(e){return e===document||_instanceof(e,Element)},K=function(e){return"object"==(void 0===e?"undefined":_type_of(e))&&null!==e&&!G(e)&&"[object Object]"===Object.prototype.toString.call(e)},F=function(e){return"string"==typeof e},H=function(e){if("true"===e)return!0;if("false"===e)return!1;var t=Number(e);return e==t&&""!==e?t:String(e)},J=function(e,t,n){return function(){for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];try{return e.apply(void 0,_to_consumable_array(o))}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}},z=function(e){return e?e.trim().replace(/^'|'$/g,"").trim():""},Y=function(e,t){return e+(null!=t?(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?"-":"")+t:"")},V=function(e,t,n){return ie(I(t,Y(e,n,!(arguments.length>3&&void 0!==arguments[3])||arguments[3]))||"").reduce(function(e,n){var r=_sliced_to_array(ce(n),2),o=r[0],a=r[1];if(!o)return e;if(a||(o.endsWith(":")&&(o=o.slice(0,-1)),a=""),a.startsWith("#")){a=a.slice(1);try{var i=t[a];i||"selected"!==a||(i=t.options[t.selectedIndex].text),a=String(i)}catch(i){a=""}}return o.endsWith("[]")?(o=o.slice(0,-2),G(e[o])||(e[o]=[]),e[o].push(H(a))):e[o]=H(a),e},{})},$=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:et.Commands.Prefix,r=e||document.body;if(!r)return[];var o=[],a=et.Commands.Action,i="[".concat(Y(n,a,!1),"]"),c=function(e){Object.keys(V(n,e,a,!1)).forEach(function(t){o=o.concat(Q(e,t,n))})};return r!==document&&(null==(t=r.matches)?void 0:t.call(r,i))&&c(r),ae(r,i,c),o},Q=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:et.Commands.Prefix,r=[],o=function(e,t,n){for(var r=t;r;){var o=I(r,Y(e,et.Commands.Actions,!1));if(o){var a=te(o);if(a[n])return{actions:a[n],nearestOnly:!1}}var i=I(r,Y(e,et.Commands.Action,!1));if(i){var c=te(i);if(c[n]||"click"!==n)return{actions:c[n]||[],nearestOnly:!0}}r=re(e,r)}return{actions:[],nearestOnly:!1}}(n,e,t),a=o.actions,i=o.nearestOnly;return a.length?(a.forEach(function(o){var a=ie(o.actionParams||"",",").reduce(function(e,t){return e[z(t)]=!0,e},{}),c=ne(n,e,a,i);if(!c.length){var s="page",u="[".concat(Y(n,s),"]"),l=_sliced_to_array(oe(e,u,n,s),2),f=l[0],d=l[1];c.push({entity:s,data:f,nested:[],context:d})}c.forEach(function(e){r.push({entity:e.entity,action:o.action,data:e.data,trigger:t,context:e.context,nested:e.nested})})}),r):r},Z=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:et.Commands.Prefix,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document,n=Y(e,et.Commands.Globals,!1),r={};return ae(t,"[".concat(n,"]"),function(t){r=B(r,V(e,t,et.Commands.Globals,!1))}),r},ee=function(e,t){var n=window.location,r="page",o=t===document?document.body:t,a=_sliced_to_array(oe(o,"[".concat(Y(e,r),"]"),e,r),2),i=a[0],c=a[1];return i.domain=n.hostname,i.title=document.title,i.referrer=document.referrer,n.search&&(i.search=n.search),n.hash&&(i.hash=n.hash),[i,c]},te=function(e){var t={};return ie(e).forEach(function(e){var n=_sliced_to_array(ce(e),2),r=n[0],o=n[1],a=_sliced_to_array(se(r),2),i=a[0],c=a[1];if(i){var s=_sliced_to_array(se(o||""),2),u=s[0],l=s[1];u=u||i,t[i]||(t[i]=[]),t[i].push({trigger:i,triggerParams:c,action:u,actionParams:l})}}),t},ne=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=[],a=t;for(n=0!==Object.keys(n||{}).length?n:void 0;a;){var i=ut(e,a,t,n);if(i&&(o.push(i),r))break;a=re(e,a)}return o},re=function(e,t){var n=Y(e,et.Commands.Link,!1);if(t.matches("[".concat(n,"]"))){var r=_sliced_to_array(ce(I(t,n)),2),o=r[0];if("child"===r[1])return document.querySelector("[".concat(n,'="').concat(o,':parent"]'))}return!t.parentElement&&t.getRootNode&&_instanceof(t.getRootNode(),ShadowRoot)?t.getRootNode().host:t.parentElement},oe=function(e,t,n,r){for(var o={},a={},i=e,c="[".concat(Y(n,et.Commands.Context,!1),"]"),s=0;i;)i.matches(t)&&(o=B(V(n,i,""),o),o=B(V(n,i,r),o)),i.matches(c)&&(Object.entries(V(n,i,et.Commands.Context,!1)).forEach(function(e){var t=_sliced_to_array(e,2),n=t[0],r=t[1];r&&!a[n]&&(a[n]=[r,s])}),++s),i=re(n,i);return[o,a]},ae=function(e,t,n){e.querySelectorAll(t).forEach(n)},ie=function(e){if(!e)return[];var t=new RegExp("(?:[^".concat(arguments.length>1&&void 0!==arguments[1]?arguments[1]:";","']+|'[^']*')+"),"ig");return e.match(t)||[]},ce=function(e){var t=_sliced_to_array(e.split(/:(.+)/,2),2),n=t[0],r=t[1];return[z(n),z(r)]},se=function(e){var t=_sliced_to_array(e.split("(",2),2),n=t[0],r=t[1];return[n,r?r.slice(0,-1):""]},ue=function(e){var t=Date.now(),n=dt.get(e);return(!n||t-n.lastChecked>500)&&(n={isVisible:U(e),lastChecked:t},dt.set(e,n)),n.isVisible},le=function(e){if(window.IntersectionObserver)return J(function(){return new window.IntersectionObserver(function(t){t.forEach(function(t){!function(e,t){var n,r,o=t.target,a=_t.get(e);if(a){var i=a.timers.get(o);if(t.intersectionRatio>0){var c=Date.now(),s=ft.get(o);if((!s||c-s.lastChecked>1e3)&&(s={isLarge:o.offsetHeight>window.innerHeight,lastChecked:c},ft.set(o,s)),t.intersectionRatio>=.5||s.isLarge&&ue(o)){var u=null==(n=a.elementConfigs)?void 0:n.get(o);if((null==u?void 0:u.multiple)&&u.blocked)return;if(!i){var l=window.setTimeout(function(){return _async_to_generator(function(){var t,n,r,i;return _ts_generator(this,function(c){switch(c.label){case 0:return ue(o)?(r=null==(t=a.elementConfigs)?void 0:t.get(o),(null==r?void 0:r.context)?[4,ye(r.context,o,r.trigger)]:[3,2]):[3,3];case 1:c.sent(),c.label=2;case 2:(null==(i=null==(n=a.elementConfigs)?void 0:n.get(o))?void 0:i.multiple)?i.blocked=!0:function(e,t){var n=_t.get(e);if(n){n.observer&&n.observer.unobserve(t);var r=n.timers.get(t);r&&(clearTimeout(r),n.timers.delete(t)),ft.delete(t),dt.delete(t)}}(e,o),c.label=3;case 3:return[2]}})})()},a.duration);a.timers.set(o,l)}return}}i&&(clearTimeout(i),a.timers.delete(o));var f=null==(r=a.elementConfigs)?void 0:r.get(o);(null==f?void 0:f.multiple)&&(f.blocked=!1)}}(e,t)})},{rootMargin:"0px",threshold:[0,.5]})},function(){})()},fe=function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{multiple:!1},o=e.settings.scope||document,a=_t.get(o);(null==a?void 0:a.observer)&&t&&(a.elementConfigs||(a.elementConfigs=new WeakMap),a.elementConfigs.set(t,{multiple:null!=(n=r.multiple)&&n,blocked:!1,context:e,trigger:r.multiple?"visible":"impression"}),a.observer.observe(t))},de=function(e){if(e){var t=_t.get(e);t&&(t.observer&&t.observer.disconnect(),_t.delete(e))}},_e=function(e,t,n,r,o,a,i){var c=e.elb,s=e.settings;if(F(t)&&t.startsWith("walker "))return c(t,n);if(K(t)){var u=t;return u.source||(u.source=ge()),u.globals||(u.globals=Z(s.prefix,s.scope||document)),c(u)}var l,f=_sliced_to_array(String(K(t)?t.name:t).split(" "),1)[0],d=K(n)?n:{},_={},g=!1;if(M(n)&&(l=n,g=!0),M(o)?l=o:K(o)&&Object.keys(o).length&&(_=o),l){var v=ne(s.prefix||"data-elb",l).find(function(e){return e.entity===f});v&&(g&&(d=v.data),_=v.context)}"page"===f&&(d.id=d.id||window.location.pathname);var p=Z(s.prefix,s.scope);return c({name:String(t||""),data:d,context:_,globals:p,nested:a,custom:i,trigger:F(r)?r:"",source:ge()})},ge=function(){return{type:"browser",id:window.location.href,previous_id:document.referrer}},ve=function(e,t){var n,r;t.scope&&(n=e,(r=t.scope)&&(r.addEventListener("click",J(function(e){he.call(this,n,e)})),r.addEventListener("submit",J(function(e){be.call(this,n,e)}))))},pe=function(e,t){t.scope&&function(e,t){var n=t.scope;gt=[];var r=n||document;de(r),function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;_t.has(e)||_t.set(e,{observer:le(e),timers:new WeakMap,duration:t})}(r,1e3);var o,a,i,c=Y(t.prefix,et.Commands.Action,!1);r!==document&&me(e,r,c,t),r.querySelectorAll("[".concat(c,"]")).forEach(function(n){me(e,n,c,t)}),gt.length&&(o=e,a=r,i=function(e,t){return e.filter(function(e){var n=_sliced_to_array(e,2),r=n[0],o=n[1],a=window.scrollY+window.innerHeight,i=r.offsetTop;if(a<i)return!0;var c=r.clientHeight;return!(100*(1-(i+c-a)/(c||1))>=o&&(ye(t,r,ht),1))})},lt||(lt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,n=null;return function(){for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];if(null===n)return n=setTimeout(function(){n=null},t),e.apply(void 0,_to_consumable_array(o))}}(function(){gt=i.call(a,gt,o)}),a.addEventListener("scroll",lt)))}(e,t)},ye=function(e,t,n){return _async_to_generator(function(){var r;return _ts_generator(this,function(o){return r=Q(t,n,e.settings.prefix),[2,Promise.all(r.map(function(t){return _e(e,_object_spread_props(_object_spread({name:"".concat(t.entity," ").concat(t.action)},t),{trigger:n}))}))]})})()},me=function(e,t,n,r){var o=I(t,n);o&&Object.values(te(o)).forEach(function(n){return n.forEach(function(n){switch(n.trigger){case pt:r=e,t.addEventListener("mouseenter",J(function(e){_instanceof(e.target,Element)&&ye(r,e.target,pt)}));break;case yt:!function(e,t){ye(e,t,yt)}(e,t);break;case mt:!function(e,t){setInterval(function(){document.hidden||ye(e,t,mt)},parseInt((arguments.length>2&&void 0!==arguments[2]?arguments[2]:"")||"")||15e3)}(e,t,n.triggerParams);break;case ht:!function(e){var t=parseInt((arguments.length>1&&void 0!==arguments[1]?arguments[1]:"")||"")||50;t<0||t>100||gt.push([e,t])}(t,n.triggerParams);break;case wt:fe(e,t);break;case jt:fe(e,t,{multiple:!0});break;case kt:!function(e,t){setTimeout(function(){return ye(e,t,kt)},parseInt((arguments.length>2&&void 0!==arguments[2]?arguments[2]:"")||"")||15e3)}(e,t,n.triggerParams)}var r})})},he=function(e,t){ye(e,t.target,vt)},be=function(e,t){t.target&&ye(e,t.target,bt)},we=function(e,t,n,r){var o=[],a=!0;n.forEach(function(e){var t,n=ke(e)?_to_consumable_array(Array.from(e)):null!=(t=e)&&"object"==(void 0===t?"undefined":_type_of(t))&&"length"in t&&"number"==typeof t.length?Array.from(e):[e];if((!Array.isArray(n)||0!==n.length)&&(!Array.isArray(n)||1!==n.length||n[0])){var i=n[0],c=!K(i)&&F(i)&&i.startsWith("walker ");if(K(i)){if("object"==(void 0===i?"undefined":_type_of(i))&&0===Object.keys(i).length)return}else{var s=Array.from(n);if(!F(s[0])||""===s[0].trim())return;a&&"walker run"===s[0]&&(a=!1)}(r&&c||!r&&!c)&&o.push(n)}}),o.forEach(function(n){je(e,t,n)})},je=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"data-elb",n=arguments.length>2?arguments[2]:void 0;J(function(){if(Array.isArray(n)){var r=_to_array(n),o=r[0],a=r.slice(1);if(!o||F(o)&&""===o.trim())return;if(F(o)&&o.startsWith("walker "))return void e(o,a[0]);_e.apply(void 0,[{elb:e,settings:{prefix:t,scope:document,pageview:!1,session:!1,elb:"",elbLayer:!1}},o].concat(_to_consumable_array(a)))}else if(n&&"object"==(void 0===n?"undefined":_type_of(n))){if(0===Object.keys(n).length)return;e(n)}},function(){})()},ke=function(e){return null!=e&&"object"==(void 0===e?"undefined":_type_of(e))&&"[object Arguments]"===Object.prototype.toString.call(e)},Oe=function(e){var r=arguments.length>2?arguments[2]:void 0;return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.cb,o=e.consent,a=e.collector,c=e.storage;if(!o)return D((c?W:X)(e),a,r);var s,u,l,f=(s=e,u=r,function(e,r){if(!n(l)||l!==(null==e?void 0:e.group)){l=null==e?void 0:e.group;var o=function(){return X(s)};if(s.consent){var a=(t(s.consent)?s.consent:[s.consent]).reduce(function(e,t){return _object_spread_props(_object_spread({},e),_define_property({},t,!0))},{});i(a,r)&&(o=function(){return W(s)})}return D(o(),e,u)}}),d=(t(o)?o:[o]).reduce(function(e,t){return _object_spread_props(_object_spread({},e),_define_property({},t,f))},{});a?a.command("on","consent",d):nt("walker on","consent",d)}(_object_spread_props(_object_spread({},arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),{collector:{push:e,group:void 0,command:r}}))},Se=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2?arguments[2]:void 0;if(!n.filter||!0!==_(function(){return n.filter(a)},function(){return!1})()){var i,c,s=r(i=a)&&o(i.event)?_object_spread({name:i.event},_object_without_properties(i,["event"])):t(i)&&i.length>=2?Ee(i):null!=(c=i)&&"object"==(void 0===c?"undefined":_type_of(c))&&"length"in c&&"number"==typeof c.length&&c.length>0?Ee(Array.from(i)):null;if(s){var u="".concat(n.prefix||"dataLayer"," ").concat(s.name),l=(s.name,{name:u,data:_object_without_properties(s,["name"])});_(function(){return e(l)},function(){})()}}},Ee=function(e){var t=_sliced_to_array(e,3),n=t[0],a=t[1],i=t[2];if(!o(n))return null;var c,s={};switch(n){case"consent":if(!o(a)||e.length<3)return null;if("default"!==a&&"update"!==a)return null;if(!r(i)||null===i)return null;c="".concat(n," ").concat(a),s=_object_spread({},i);break;case"event":if(!o(a))return null;c=a,r(i)&&(s=_object_spread({},i));break;case"config":if(!o(a))return null;c="".concat(n," ").concat(a),r(i)&&(s=_object_spread({},i));break;case"set":if(o(a))c="".concat(n," ").concat(a),r(i)&&(s=_object_spread({},i));else{if(!r(a))return null;c="".concat(n," custom"),s=_object_spread({},a)}break;default:return null}return _object_spread({name:c},s)},xe=function(){return["consent","update",{ad_user_data:"granted",ad_personalization:"granted",ad_storage:"denied",analytics_storage:"granted"}]},Ce=function(){return["consent","default",{ad_storage:"denied",analytics_storage:"denied",ad_user_data:"denied",ad_personalization:"denied"}]},Ae=function(){return["event","purchase",{transaction_id:"T_12345",value:25.42,currency:"EUR",items:[{item_id:"SKU_12345",item_name:"Product Name",item_category:"Category",quantity:1,price:25.42}]}]},Pe=function(){return["event","add_to_cart",{currency:"EUR",value:15.25,items:[{item_id:"SKU_12345",item_name:"Product Name",item_variant:"red",quantity:1,price:15.25}]}]},Le=function(){return["event","view_item",{currency:"EUR",value:15.25,items:[{item_id:"SKU_12345",item_name:"Product Name",item_category:"Category",price:15.25}]}]},Re=function(){return["config","G-XXXXXXXXXX",{page_title:"Custom Page Title",page_location:"https://example.com/page",send_page_view:!1}]},qe=function(){return["set",{currency:"EUR",country:"DE"}]},Ie=function(){return{event:"custom_event",custom_parameter:"custom_value",user_id:"user123"}},Ue=function(){window.dataLayer=window.dataLayer||[];var e=function(e){r(e)&&r(e.source)&&String(e.source.type).includes("dataLayer")||window.dataLayer.push(e)};return{type:"dataLayer",config:{},push:function(t,n){e(n.data||t)},pushBatch:function(t){e({name:"batch",batched_event:t.key,events:t.data.length?t.data:t.events})}}},De=function(){return _async_to_generator(function(){var t,n,o,a,i,c,s=arguments;return _ts_generator(this,function(u){switch(u.label){case 0:return t=s.length>0&&void 0!==s[0]?s[0]:{},n={collector:{destinations:{dataLayer:{code:Ue()}}},browser:{session:!0},dataLayer:!1,elb:"elb",run:!0},o=e(n,t),a=_object_spread_props(_object_spread({},o.collector),{sources:{browser:{code:At,config:{settings:o.browser},env:{window:"undefined"!=typeof window?window:void 0,document:"undefined"!=typeof document?document:void 0}}}}),o.dataLayer&&(i=r(o.dataLayer)?o.dataLayer:{},a.sources&&(a.sources.dataLayer={code:Ht,config:{settings:i}})),[4,(l=a,_async_to_generator(function(){var e,t,n,r,o,a,i,c,s,u,f;return _ts_generator(this,function(d){switch(d.label){case 0:return[4,R(l=l||{})];case 1:return e=d.sent(),n=e,t={type:"elb",config:{},push:function(e,t,r,o,a,i){return _async_to_generator(function(){var c,s;return _ts_generator(this,function(u){if("string"==typeof e&&e.startsWith("walker "))return c=e.replace("walker ",""),[2,n.command(c,t,r)];if("string"==typeof e)s={name:e},t&&"object"==(void 0===t?"undefined":_type_of(t))&&!Array.isArray(t)&&(s.data=t);else{if(!e||"object"!=(void 0===e?"undefined":_type_of(e)))return[2,{ok:!1,successful:[],queued:[],failed:[]}];s=e,t&&"object"==(void 0===t?"undefined":_type_of(t))&&!Array.isArray(t)&&(s.data=_object_spread({},s.data||{},t))}return[2,(o&&"object"==(void 0===o?"undefined":_type_of(o))&&(s.context=o),a&&Array.isArray(a)&&(s.nested=a),i&&"object"==(void 0===i?"undefined":_type_of(i))&&(s.custom=i),n.push(s))]})})()}},e.sources.elb=t,[4,q(e,l.sources||{})];case 2:return r=d.sent(),Object.assign(e.sources,r),o=l.consent,a=l.user,i=l.globals,c=l.custom,o?[4,e.command("consent",o)]:[3,4];case 3:d.sent(),d.label=4;case 4:return a?[4,e.command("user",a)]:[3,6];case 5:d.sent(),d.label=6;case 6:return i&&Object.assign(e.globals,i),c&&Object.assign(e.custom,c),e.config.run?[4,e.command("run")]:[3,8];case 7:d.sent(),d.label=8;case 8:return s=t.push,u=Object.values(e.sources).filter(function(e){return"elb"!==e.type}),[2,((f=u.find(function(e){return e.config.primary}))?s=f.push:u.length>0&&(s=u[0].push),{collector:e,elb:s})]}})})())];case 1:return c=u.sent(),"undefined"!=typeof window&&(o.elb&&(window[o.elb]=c.elb),o.name&&(window[o.name]=c.collector)),[2,c]}var l})}).apply(this,arguments)},Ne=Object.defineProperty,Te=Object.getOwnPropertyDescriptor,We=Object.getOwnPropertyNames,Xe=Object.prototype.hasOwnProperty,Be={};!function(e,t){for(var n in t)Ne(e,n,{get:t[n],enumerable:!0})}(Be,{Walkerjs:function(){return Jt},createWalkerjs:function(){return De},default:function(){return zt},getAllEvents:function(){return $},getEvents:function(){return Q},getGlobals:function(){return Z}});var Ge=Object.defineProperty;!function(e,t){for(var n in t)Ge(e,n,{get:t[n],enumerable:!0})}({},{Level:function(){return Ke}});var Me,Ke=((Me=Ke||{})[Me.ERROR=0]="ERROR",Me[Me.INFO=1]="INFO",Me[Me.DEBUG=2]="DEBUG",Me),Fe={Utils:{Storage:{Local:"local",Session:"session",Cookie:"cookie"}}},He={merge:!0,shallow:!0,extend:!0};function Je(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new WeakMap;if("object"!=(void 0===e?"undefined":_type_of(e))||null===e)return e;if(t.has(e))return t.get(e);var n=Object.prototype.toString.call(e);if("[object Object]"===n){var r={};for(var o in t.set(e,r),e)Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=Je(e[o],t));return r}if("[object Array]"===n){var a=[];return t.set(e,a),e.forEach(function(e){a.push(Je(e,t))}),a}if("[object Date]"===n)return new Date(e.getTime());if("[object RegExp]"===n){var i=e;return new RegExp(i.source,i.flags)}return e}function ze(e){for(var r=arguments.length>2?arguments[2]:void 0,o=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"").split("."),a=e,i=0;i<o.length;i++){var c=o[i];if("*"===c&&t(a)){var s=o.slice(i+1).join("."),u=[],l=!0,f=!1,d=void 0;try{for(var _,g=a[Symbol.iterator]();!(l=(_=g.next()).done);l=!0){var v=ze(_.value,s,r);u.push(v)}}catch(e){f=!0,d=e}finally{try{l||null==g.return||g.return()}finally{if(f)throw d}}return u}if(!(a=_instanceof(a,Object)?a[c]:void 0))break}return n(a)?a:r}var Ye=function(e,t,n,r){var o="".concat(Ke[e]).concat(r.length>0?" [".concat(r.join(":"),"]"):""),a=Object.keys(n).length>0;0===e?a?console.error(o,t,n):console.error(o,t):a?console.log(o,t,n):console.log(o,t)};function Ve(e){var t=e.level,n=e.handler,r=e.scope,o=function(e,o,a){if(e<=t){var i=l(o,a);n?n(e,i.message,i.context,r,Ye):Ye(e,i.message,i.context,r)}};return{error:function(e,t){return o(0,e,t)},info:function(e,t){return o(1,e,t)},debug:function(e,t){return o(2,e,t)},throw:function(e,t){var o=l(e,t);throw n?n(0,o.message,o.context,r,Ye):Ye(0,o.message,o.context,r),new Error(o.message)},scope:function(e){return Ve({level:t,handler:n,scope:_to_consumable_array(r).concat([e])})}}}function $e(e){return function(e){return"boolean"==typeof e}(e)||o(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!n(e)||t(e)&&e.every($e)||r(e)&&Object.values(e).every($e)}function Qe(e,r){return _async_to_generator(function(e,r){var a,c,s,u=arguments;return _ts_generator(this,function(l){return c=(a=u.length>2&&void 0!==u[2]?u[2]:{}).collector,s=a.consent,[2,(t(r)?r:[r]).reduce(function(r,u){return _async_to_generator(function(){var l,f,_,v,y,m,h,b,w,j,k,O,S,E,x,C,A,P,L,R,q;return _ts_generator(this,function(I){switch(I.label){case 0:return[4,r];case 1:return(l=I.sent())?[2,l]:(f=o(u)?{key:u}:u,Object.keys(f).length?(_=f.condition,v=f.consent,y=f.fn,m=f.key,h=f.loop,b=f.map,w=f.set,j=f.validate,k=f.value,(O=_)?[4,g(_)(e,u,c)]:[3,3]):[2]);case 2:O=!I.sent(),I.label=3;case 3:return O?[2]:v&&!i(v,s)?[2,k]:(S=n(k)?k:e,y?[4,g(y)(e,u,a)]:[3,5]);case 4:S=I.sent(),I.label=5;case 5:return m&&(S=ze(e,m,k)),h?(E=_sliced_to_array(h,2),x=E[0],C=E[1],"this"!==x?[3,6]:(P=[e],[3,8])):[3,11];case 6:return[4,p(e,x,a)];case 7:P=I.sent(),I.label=8;case 8:return t(A=P)?[4,Promise.all(A.map(function(e){return p(e,C,a)}))]:[3,10];case 9:S=I.sent().filter(n),I.label=10;case 10:return[3,17];case 11:return b?[4,Object.entries(b).reduce(function(t,r){var o=_sliced_to_array(r,2),i=o[0],c=o[1];return _async_to_generator(function(){var r,o;return _ts_generator(this,function(s){switch(s.label){case 0:return[4,t];case 1:return r=s.sent(),[4,p(e,c,a)];case 2:return o=s.sent(),[2,(n(o)&&(r[i]=o),r)]}})})()},Promise.resolve({}))]:[3,13];case 12:return S=I.sent(),[3,16];case 13:return(L=w)?[4,Promise.all(w.map(function(t){return Qe(e,t,a)}))]:[3,15];case 14:L=S=I.sent(),I.label=15;case 15:I.label=16;case 16:I.label=17;case 17:return(R=j)?[4,g(j)(S)]:[3,19];case 18:R=!I.sent(),I.label=19;case 19:return R&&(S=void 0),q=d(S),[2,n(q)?q:d(k)]}})})()},Promise.resolve(void 0))]})}).apply(this,arguments)}var Ze,et={Commands:{Action:"action",Actions:"actions",Config:"config",Consent:"consent",Context:"context",Custom:"custom",Destination:"destination",Elb:"elb",Globals:"globals",Hook:"hook",Init:"init",Link:"link",On:"on",Prefix:"data-elb",Ready:"ready",Run:"run",Session:"session",User:"user",Walker:"walker"},Utils:{Storage:{Cookie:"cookie",Local:"local",Session:"session"}}},tt={type:"code",config:{},init:function(e){var t=e.config,n=e.logger,r=t.settings,o=null==r?void 0:r.scripts,a=!0,i=!1,c=void 0;if(o&&"undefined"!=typeof document)try{for(var s,u=o[Symbol.iterator]();!(a=(s=u.next()).done);a=!0){var l=s.value,f=document.createElement("script");f.src=l,f.async=!0,document.head.appendChild(f)}}catch(e){i=!0,c=e}finally{try{a||null==u.return||u.return()}finally{if(i)throw c}}var d=null==r?void 0:r.init;if(d)try{new Function("context",d)(e)}catch(e){n.error("Code destination init error:",e)}},push:function(e,t){var n,r,o=t.mapping,a=t.config,i=t.logger,c=null!==(r=null==o?void 0:o.push)&&void 0!==r?r:null===(n=a.settings)||void 0===n?void 0:n.push;if(c)try{new Function("event","context",c)(e,t)}catch(e){i.error("Code destination push error:",e)}},pushBatch:function(e,t){var n,r,o=t.mapping,a=t.config,i=t.logger,c=null!==(r=null==o?void 0:o.pushBatch)&&void 0!==r?r:null===(n=a.settings)||void 0===n?void 0:n.pushBatch;if(c)try{new Function("batch","context",c)(e,t)}catch(e){i.error("Code destination pushBatch error:",e)}},on:function(e,t){var n,r=t.config,o=t.logger,a=null===(n=r.settings)||void 0===n?void 0:n.on;if(a)try{new Function("type","context",a)(e,t)}catch(e){o.error("Code destination on error:",e)}}},nt=function(){var e=window;(e.elbLayer=e.elbLayer||[]).push(arguments)},rt=function(e,t){var n={};return e.id&&(n.session=e.id),e.storage&&e.device&&(n.device=e.device),t?t.command("user",n):nt("walker user",n),e.isStart&&(t?t.push({name:"session start",data:e}):nt({name:"session start",data:e})),e},ot=Object.defineProperty,at=function(e,t){for(var n in t)ot(e,n,{get:t[n],enumerable:!0})},it=Object.defineProperty;!function(e,t){for(var n in t)it(e,n,{get:t[n],enumerable:!0})}({},{Level:function(){return ct}});var ct=((Ze=ct||{})[Ze.ERROR=0]="ERROR",Ze[Ze.INFO=1]="INFO",Ze[Ze.DEBUG=2]="DEBUG",Ze),st={merge:!0,shallow:!0,extend:!0};function ut(e,t,n,r){var o=I(t,Y(e));if(!o||r&&!r[o])return null;var a=[t],i="[".concat(Y(e,o),"],[").concat(Y(e,""),"]"),c=Y(e,et.Commands.Link,!1),s={},u=[],l=_sliced_to_array(oe(n||t,i,e,o),2),f=l[0],d=l[1];ae(t,"[".concat(c,"]"),function(t){var n=_sliced_to_array(ce(I(t,c)),2),r=n[0];"parent"===n[1]&&ae(document.body,"[".concat(c,'="').concat(r,':child"]'),function(t){a.push(t);var n=ut(e,t);n&&u.push(n)})});var _=[];a.forEach(function(e){e.matches(i)&&_.push(e),ae(e,i,function(e){return _.push(e)})});var g={};return _.forEach(function(t){g=B(g,V(e,t,"")),s=B(s,V(e,t,o))}),s=B(B(g,s),f),a.forEach(function(t){ae(t,"[".concat(Y(e),"]"),function(t){var n=ut(e,t);n&&u.push(n)})}),{entity:o,data:s,context:d,nested:u}}var lt,ft=new WeakMap,dt=new WeakMap,_t=new WeakMap,gt=[],vt="click",pt="hover",yt="load",mt="pulse",ht="scroll",bt="submit",wt="impression",jt="visible",kt="wait";at({},{env:function(){return Ot}});var Ot={};at(Ot,{push:function(){return Ct}});var St=function(){},Et=function(){return function(){return Promise.resolve({ok:!0,successful:[],queued:[],failed:[]})}},xt={error:St,info:St,debug:St,throw:function(e){throw"string"==typeof e?new Error(e):e},scope:function(){return xt}},Ct={get push(){return Et()},get command(){return Et()},get elb(){return Et()},get window(){return{addEventListener:St,removeEventListener:St,location:{href:"https://example.com/page",pathname:"/page",search:"?query=test",hash:"#section",host:"example.com",hostname:"example.com",origin:"https://example.com",protocol:"https:"},document:{},navigator:{language:"en-US",userAgent:"Mozilla/5.0 (Test)"},screen:{width:1920,height:1080},innerWidth:1920,innerHeight:1080,pageXOffset:0,pageYOffset:0,scrollX:0,scrollY:0}},get document(){return{addEventListener:St,removeEventListener:St,querySelector:St,querySelectorAll:function(){return[]},getElementById:St,getElementsByClassName:function(){return[]},getElementsByTagName:function(){return[]},createElement:function(){return{setAttribute:St,getAttribute:St,addEventListener:St,removeEventListener:St}},body:{appendChild:St,removeChild:St},documentElement:{scrollTop:0,scrollLeft:0},readyState:"complete",title:"Test Page",referrer:"",cookie:""}},logger:xt},At=function(e,t){return _async_to_generator(function(){var n,r,o,a,i,c,s,u,l,f,d;return _ts_generator(this,function(_){switch(_.label){case 0:return n=t.elb,r=t.command,o=t.window,a=t.document,i=(null==e?void 0:e.settings)||{},c=o||(void 0!==globalThis.window?globalThis.window:void 0),s=a||(void 0!==globalThis.document?globalThis.document:void 0),u=function(){return _object_spread({prefix:"data-elb",pageview:!0,session:!0,elb:"elb",elbLayer:"elbLayer",scope:(arguments.length>1?arguments[1]:void 0)||void 0},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})}(i,s),l={settings:u},f={elb:n,settings:u},c&&s?(!1!==u.elbLayer&&n&&function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.name||"elbLayer",r=t.window||window;if(r){var o=r;o[n]||(o[n]=[]);var a=o[n];a.push=function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];if(ke(r[0])){var a=_to_consumable_array(Array.from(r[0])),i=Array.prototype.push.apply(this,[a]);return je(e,t.prefix,a),i}var c=Array.prototype.push.apply(this,r);return r.forEach(function(n){je(e,t.prefix,n)}),c},Array.isArray(a)&&a.length>0&&function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"data-elb",n=arguments.length>2?arguments[2]:void 0;we(e,t,n,!0),we(e,t,n,!1),n.length=0}(e,t.prefix,a)}}(n,{name:F(u.elbLayer)?u.elbLayer:"elbLayer",prefix:u.prefix,window:c}),u.session&&n&&(d="boolean"==typeof u.session?{}:u.session,Oe(n,d,r)),[4,function(e,t,n){return _async_to_generator(function(){var r;return _ts_generator(this,function(o){return r=function(){e(t,n)},"loading"!==document.readyState?r():document.addEventListener("DOMContentLoaded",r),[2]})})()}(ve,f,u)]):[3,2];case 1:_.sent(),function(){if(pe(f,u),u.pageview){var e=_sliced_to_array(ee(u.prefix||"data-elb",u.scope),2),t=e[0],n=e[1];_e(f,"page view",t,"load",n)}}(),F(u.elb)&&u.elb&&(c[u.elb]=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=_sliced_to_array(t,6),o=r[0],a=r[1],i=r[2],c=r[3],s=r[4],u=r[5];return _e(f,o,a,i,c,s,u)}),_.label=2;case 2:return[2,{type:"browser",config:l,push:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=_sliced_to_array(t,6),o=r[0],a=r[1],i=r[2],c=r[3],s=r[4],u=r[5];return _e(f,o,a,i,c,s,u)},destroy:function(){return _async_to_generator(function(){return _ts_generator(this,function(e){return s&&de(u.scope||s),[2]})})()},on:function(e,t){return _async_to_generator(function(){var o,a,i,l;return _ts_generator(this,function(d){switch(e){case"consent":u.session&&t&&n&&(o="boolean"==typeof u.session?{}:u.session,Oe(n,o,r));break;case"session":case"ready":default:break;case"run":s&&c&&(pe(f,u),u.pageview)&&(a=_sliced_to_array(ee(u.prefix||"data-elb",u.scope),2),i=a[0],l=a[1],_e(f,"page view",i,"load",l))}return[2]})})()}}]}})})()},Pt=Object.defineProperty,Lt=function(e,t){for(var n in t)Pt(e,n,{get:t[n],enumerable:!0})},Rt=!1;Lt({},{push:function(){return Dt}});var qt=function(){},It=function(){return function(){return Promise.resolve({ok:!0,successful:[],queued:[],failed:[]})}},Ut={error:qt,info:qt,debug:qt,throw:function(e){throw"string"==typeof e?new Error(e):e},scope:function(){return Ut}},Dt={get push(){return It()},get command(){return It()},get elb(){return It()},get window(){return{dataLayer:[],addEventListener:qt,removeEventListener:qt}},logger:Ut};Lt({},{add_to_cart:function(){return Pe},config:function(){return Re},consentDefault:function(){return Ce},consentUpdate:function(){return xe},directDataLayerEvent:function(){return Ie},purchase:function(){return Ae},setCustom:function(){return qe},view_item:function(){return Le}});Lt({},{add_to_cart:function(){return Xt},config:function(){return Kt},configGA4:function(){return Gt},consentOnlyMapping:function(){return Ft},consentUpdate:function(){return Tt},customEvent:function(){return Mt},purchase:function(){return Wt},view_item:function(){return Bt}});var Nt,Tt={name:"walker consent",settings:{command:{map:{functional:{value:!0},analytics:{key:"analytics_storage",fn:function(e){return"granted"===e}},marketing:{key:"ad_storage",fn:function(e){return"granted"===e}}}}}},Wt={name:"order complete",data:{map:{id:"transaction_id",total:"value",currency:"currency",nested:{loop:["items",{map:{type:{value:"product"},data:{map:{id:"item_id",name:"item_name",category:"item_category",quantity:"quantity",price:"price"}}}}]}}}},Xt={name:"product add",data:{map:{id:"items.0.item_id",name:"items.0.item_name",price:"value",currency:"currency",color:"items.0.item_variant",quantity:"items.0.quantity"}}},Bt={name:"product view",data:{map:{id:"items.0.item_id",name:"items.0.item_name",category:"items.0.item_category",price:"items.0.price",currency:"currency"}}},Gt={name:"page view",data:{map:{title:"page_title",url:"page_location"}}},Mt={data:{map:{user_id:"user_id",custom_parameter:"custom_parameter"}}},Kt={consent:{update:Tt},purchase:Wt,add_to_cart:Xt,view_item:Bt,"config G-XXXXXXXXXX":Gt,custom_event:Mt,"*":{data:{}}},Ft={consent:{update:Tt}},Ht=function(e,t){return _async_to_generator(function(){var n,r,o,a;return _ts_generator(this,function(i){return n=t.elb,r=t.window,o=_object_spread({name:"dataLayer",prefix:"dataLayer"},null==e?void 0:e.settings),a={settings:o},[2,(r&&(function(e,t){var n=t.settings,r=(null==n?void 0:n.name)||"dataLayer",o=window[r];if(Array.isArray(o)&&!Rt){Rt=!0;try{var a=!0,i=!1,c=void 0;try{for(var s,u=o[Symbol.iterator]();!(a=(s=u.next()).done);a=!0){var l=s.value;Se(e,n,l)}}catch(e){i=!0,c=e}finally{try{a||null==u.return||u.return()}finally{if(i)throw c}}}finally{Rt=!1}}}(n,a),function(e,t){var n=t.settings,r=(null==n?void 0:n.name)||"dataLayer";window[r]||(window[r]=[]);var o=window[r];if(Array.isArray(o)){var a=o.push.bind(o);o.push=function(){for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];if(Rt)return a.apply(void 0,_to_consumable_array(r));Rt=!0;try{var i=!0,c=!1,s=void 0;try{for(var u,l=r[Symbol.iterator]();!(i=(u=l.next()).done);i=!0){var f=u.value;Se(e,n,f)}}catch(e){c=!0,s=e}finally{try{i||null==l.return||l.return()}finally{if(c)throw s}}}finally{Rt=!1}return a.apply(void 0,_to_consumable_array(r))}}}(n,a)),{type:"dataLayer",config:a,push:n,destroy:function(){return _async_to_generator(function(){var e;return _ts_generator(this,function(t){return e=o.name||"dataLayer",r&&r[e]&&Array.isArray(r[e]),[2]})})()}})]})})()},Jt={},zt=De;return Nt=Be,function(e,t,n,r){if(t&&"object"===(void 0===t?"undefined":_type_of(t))||"function"==typeof t){var o=!0,a=!1,i=void 0;try{for(var c,s=function(){var o=c.value;Xe.call(e,o)||o===n||Ne(e,o,{get:function(){return t[o]},enumerable:!(r=Te(t,o))||r.enumerable})},u=We(t)[Symbol.iterator]();!(o=(c=u.next()).done);o=!0)s()}catch(e){a=!0,i=e}finally{try{o||null==u.return||u.return()}finally{if(a)throw i}}}return e}(Ne({},"__esModule",{value:!0}),Nt)}();
|
|
1
|
+
"use strict";function _array_like_to_array(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _array_with_holes(e){if(Array.isArray(e))return e}function _array_without_holes(e){if(Array.isArray(e))return _array_like_to_array(e)}function asyncGeneratorStep(e,t,n,r,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(r,o)}function _async_to_generator(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){asyncGeneratorStep(a,r,o,i,c,"next",e)}function c(e){asyncGeneratorStep(a,r,o,i,c,"throw",e)}i(void 0)})}}function _define_property(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _instanceof(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function _iterable_to_array(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _iterable_to_array_limit(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,c=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(c)throw o}}return a}}function _non_iterable_rest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _non_iterable_spread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _object_spread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){_define_property(e,t,n[t])})}return e}function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _object_spread_props(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function _object_without_properties(e,t){if(null==e)return{};var n,r,o,a={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(n=Reflect.ownKeys(e),o=0;o<n.length;o++)r=n[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r]);return a}if(a=_object_without_properties_loose(e,t),Object.getOwnPropertySymbols)for(n=Object.getOwnPropertySymbols(e),o=0;o<n.length;o++)r=n[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r]);return a}function _object_without_properties_loose(e,t){if(null==e)return{};var n,r,o={},a=Object.getOwnPropertyNames(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n]);return o}function _sliced_to_array(e,t){return _array_with_holes(e)||_iterable_to_array_limit(e,t)||_unsupported_iterable_to_array(e,t)||_non_iterable_rest()}function _to_array(e){return _array_with_holes(e)||_iterable_to_array(e)||_unsupported_iterable_to_array(e)||_non_iterable_rest()}function _to_consumable_array(e){return _array_without_holes(e)||_iterable_to_array(e)||_unsupported_iterable_to_array(e)||_non_iterable_spread()}function _type_of(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _unsupported_iterable_to_array(e,t){if(e){if("string"==typeof e)return _array_like_to_array(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_array_like_to_array(e,t):void 0}}function _ts_generator(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(i,"next",{value:s(0)}),c(i,"throw",{value:s(1)}),c(i,"return",{value:s(2)}),"function"==typeof Symbol&&c(i,Symbol.iterator,{value:function(){return this}}),i;function s(c){return function(s){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}}function _ts_values(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}var Walkerjs=function(){var e=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n=_object_spread({},He,n);var r=Object.entries(t).reduce(function(t,r){var o=_sliced_to_array(r,2),a=o[0],i=o[1],c=e[a];return n.merge&&Array.isArray(c)&&Array.isArray(i)?t[a]=i.reduce(function(e,t){return e.includes(t)?e:_to_consumable_array(e).concat([t])},_to_consumable_array(c)):(n.extend||a in e)&&(t[a]=i),t},{});return n.shallow?_object_spread({},e,r):(Object.assign(e,r),e)},t=function(e){return Array.isArray(e)},n=function(e){return void 0!==e},r=function(e){return"object"==(void 0===e?"undefined":_type_of(e))&&null!==e&&!t(e)&&"[object Object]"===Object.prototype.toString.call(e)},o=function(e){return"string"==typeof e},a=function(e,t,n){if(!r(e))return e;for(var o=Je(e),a=t.split("."),i=o,c=0;c<a.length;c++){var s=a[c];c===a.length-1?i[s]=n:(s in i&&"object"==_type_of(i[s])&&null!==i[s]||(i[s]={}),i=i[s])}return o},i=function(e){var t=_object_spread({},arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),n={},r=void 0===e;return Object.keys(t).forEach(function(o){t[o]&&(n[o]=!0,e&&e[o]&&(r=!0))}),!!r&&n},c=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:6,t="";t.length<e;)t+=(36*Math.random()|0).toString(36);return t},s=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=null,a=!1;return function(){for(var i=arguments.length,c=new Array(i),s=0;s<i;s++)c[s]=arguments[s];return new Promise(function(i){var s=r&&!a;o&&clearTimeout(o),o=setTimeout(function(){o=null,r&&!a||(t=e.apply(void 0,_to_consumable_array(c)),i(t))},n),s&&(a=!0,t=e.apply(void 0,_to_consumable_array(c)),i(t))})}},u=function(e){return{message:e.message,name:e.name,stack:e.stack,cause:e.cause}},l=function(e,t){var n,r={};return _instanceof(e,Error)?(n=e.message,r.error=u(e)):n=e,void 0!==t&&(_instanceof(t,Error)?r.error=u(t):"object"==(void 0===t?"undefined":_type_of(t))&&null!==t?"error"in(r=_object_spread({},r,t))&&_instanceof(r.error,Error)&&(r.error=u(r.error)):r.value=t),{message:n,context:r}},f=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Ve({level:void 0!==t.level?(e=t.level,"string"==typeof e?Ke[e]:e):0,handler:t.handler,scope:[]})},d=function(e){return $e(e)?e:void 0},_=function(e,t,n){return function(){for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];try{return e.apply(void 0,_to_consumable_array(o))}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}},g=function(e,t,n){return function(){for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];return _async_to_generator(function(){var r;return _ts_generator(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,4,6]),[4,e.apply(void 0,_to_consumable_array(o))];case 1:case 3:return[2,a.sent()];case 2:return r=a.sent(),t?[4,t(r)]:[2];case 4:return[4,null==n?void 0:n()];case 5:return a.sent(),[7];case 6:return[2]}})})()}},v=function(e,n){return _async_to_generator(function(){var r,o,a,i,c,s,u,l,f,d;return _ts_generator(this,function(_){return o=_sliced_to_array((e.name||"").split(" "),2),a=o[0],i=o[1],n&&a&&i?(s="",l=i,f=function(n){if(n)return(n=t(n)?n:[n]).find(function(t){return!t.condition||t.condition(e)})},n[u=a]||(u="*"),[2,((d=n[u])&&(d[l]||(l="*"),c=f(d[l])),c||(u="*",l="*",c=f(null===(r=n[u])||void 0===r?void 0:r[l])),c&&(s="".concat(u," ").concat(l)),{eventMapping:c,mappingKey:s})]):[2,{}]})})()},p=function(e){return _async_to_generator(function(e){var o,a,i,c,s,u,l,f,d,_,v,p,y,m=arguments;return _ts_generator(this,function(h){switch(h.label){case 0:if(o=m.length>1&&void 0!==m[1]?m[1]:{},a=m.length>2&&void 0!==m[2]?m[2]:{},!n(e))return[2];c=r(e)&&e.consent||a.consent||(null===(i=a.collector)||void 0===i?void 0:i.consent),s=t(o)?o:[o],u=!0,l=!1,f=void 0,h.label=1;case 1:h.trys.push([1,6,7,8]),d=s[Symbol.iterator](),h.label=2;case 2:return(u=(_=d.next()).done)?[3,5]:(v=_.value,[4,g(Qe)(e,v,_object_spread_props(_object_spread({},a),{consent:c}))]);case 3:if(p=h.sent(),n(p))return[2,p];h.label=4;case 4:return u=!0,[3,2];case 5:return[3,8];case 6:return y=h.sent(),l=!0,f=y,[3,8];case 7:try{u||null==d.return||d.return()}finally{if(l)throw f}return[7];case 8:return[2]}})}).apply(this,arguments)},y=function(t,n,o){return _async_to_generator(function(){var i,c,s,u,l,f,d;return _ts_generator(this,function(_){switch(_.label){case 0:return n.policy?[4,Promise.all(Object.entries(n.policy).map(function(e){var n=_sliced_to_array(e,2),r=n[0],i=n[1];return _async_to_generator(function(){var e;return _ts_generator(this,function(n){switch(n.label){case 0:return[4,p(t,i,{collector:o})];case 1:return e=n.sent(),t=a(t,r,e),[2]}})})()}))]:[3,2];case 1:_.sent(),_.label=2;case 2:return[4,v(t,n.mapping)];case 3:return i=_.sent(),c=i.eventMapping,s=i.mappingKey,(null==c?void 0:c.policy)?[4,Promise.all(Object.entries(c.policy).map(function(e){var n=_sliced_to_array(e,2),r=n[0],i=n[1];return _async_to_generator(function(){var e;return _ts_generator(this,function(n){switch(n.label){case 0:return[4,p(t,i,{collector:o})];case 1:return e=n.sent(),t=a(t,r,e),[2]}})})()}))]:[3,5];case 4:_.sent(),_.label=5;case 5:return(l=n.data)?[4,p(t,n.data,{collector:o})]:[3,7];case 6:l=_.sent(),_.label=7;case 7:return u=l,c?c.ignore?[2,{event:t,data:u,mapping:c,mappingKey:s,ignore:!0}]:(c.name&&(t.name=c.name),c.data?(d=c.data)?[4,p(t,c.data,{collector:o})]:[3,9]:[3,10]):[3,10];case 8:d=_.sent(),_.label=9;case 9:f=d,u=r(u)&&r(f)?e(u,f):f,_.label=10;case 10:return[2,{event:t,data:u,mapping:c,mappingKey:s,ignore:!1}]}})})()},m=function(e,t,n){return function(){for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];var i,c="post"+t,s=n["pre"+t],u=n[c];return i=s?s.apply(void 0,[{fn:e}].concat(_to_consumable_array(o))):e.apply(void 0,_to_consumable_array(o)),u&&(i=u.apply(void 0,[{fn:e,result:i}].concat(_to_consumable_array(o)))),i}},h=function(e){return!0===e?tt:e},b=function(e,t,n){return _async_to_generator(function(){var r,o,a,i,s,u,l,f,d;return _ts_generator(this,function(_){if(r=t.code,o=t.config,a=void 0===o?{}:o,i=t.env,s=void 0===i?{}:i,u=n||a||{init:!1},l=h(r),f=_object_spread_props(_object_spread({},l),{config:u,env:E(l.env,s)}),!(d=f.config.id))do{d=c(4)}while(e.destinations[d]);return[2,(e.destinations[d]=f,!1!==f.config.queue&&(f.queue=_to_consumable_array(e.queue)),w(e,void 0,_define_property({},d,f)))]})})()},w=function(t,n,r){return _async_to_generator(function(){var o,a,c,s,u,l,f,d,_,v,p,y,m,h,b,w;return _ts_generator(this,function(S){switch(S.label){case 0:return o=t.allowed,a=t.consent,c=t.globals,s=t.user,o?(n&&t.queue.push(n),r||(r=t.destinations),[4,Promise.all(Object.entries(r||{}).map(function(r){var o=_sliced_to_array(r,2),u=o[0],l=o[1];return _async_to_generator(function(){var r,o,f,d,_;return _ts_generator(this,function(v){switch(v.label){case 0:return r=(l.queue||[]).map(function(e){return _object_spread_props(_object_spread({},e),{consent:a})}),l.queue=[],n&&(o=Je(n),r.push(o)),r.length?(f=[],d=r.filter(function(e){var t=i(l.config.consent,a,e.consent);return!t||(e.consent=t,f.push(e),!1)}),l.queue.concat(d),f.length?[4,g(j)(t,l)]:[2,{id:u,destination:l,queue:r}]):[2,{id:u,destination:l,skipped:!0}];case 1:return v.sent()?(_=!1,l.dlq||(l.dlq=[]),[4,Promise.all(f.map(function(n){return _async_to_generator(function(){return _ts_generator(this,function(r){switch(r.label){case 0:return n.globals=e(c,n.globals),n.user=e(s,n.user),[4,g(k,function(e){var r=l.type||"unknown";return t.logger.scope(r).error("Push failed",{error:e,event:n.name}),_=!0,l.dlq.push([n,e]),!1})(t,l,n)];case 1:return[2,(r.sent(),n)]}})})()}))]):[2,{id:u,destination:l,queue:r}];case 2:return[2,(v.sent(),{id:u,destination:l,error:_})]}})})()}))]):[2,O({ok:!1})];case 1:u=S.sent(),l=[],f=[],d=[],_=!0,v=!1,p=void 0;try{for(y=u[Symbol.iterator]();!(_=(m=y.next()).done);_=!0)(h=m.value).skipped||(b=h.destination,w={id:h.id,destination:b},h.error?d.push(w):h.queue&&h.queue.length?(b.queue=(b.queue||[]).concat(h.queue),f.push(w)):l.push(w))}catch(e){v=!0,p=e}finally{try{_||null==y.return||y.return()}finally{if(v)throw p}}return[2,O({ok:!d.length,event:n,successful:l,queued:f,failed:d})]}})})()},j=function(e,t){return _async_to_generator(function(){var n,r,o,a;return _ts_generator(this,function(i){switch(i.label){case 0:return!t.init||t.config.init?[3,2]:(n=t.type||"unknown",r=e.logger.scope(n),o={collector:e,config:t.config,env:E(t.env,t.config.env),logger:r},r.debug("init"),[4,m(t.init,"DestinationInit",e.hooks)(o)]);case 1:if(!1===(a=i.sent()))return[2,a];t.config=_object_spread_props(_object_spread({},a||t.config),{init:!0}),r.debug("init done"),i.label=2;case 2:return[2,!0]}})})()},k=function(e,t,r){return _async_to_generator(function(){var o,a,i,c,u,l,f,d,_;return _ts_generator(this,function(g){switch(g.label){case 0:return o=t.config,[4,y(r,o,e)];case 1:return(a=g.sent()).ignore?[2,!1]:(i=t.type||"unknown",c=e.logger.scope(i),u={collector:e,config:o,data:a.data,mapping:a.mapping,env:E(t.env,o.env),logger:c},l=a.mapping,f=a.mappingKey||"* *",(null==l?void 0:l.batch)&&t.pushBatch?(t.batches=t.batches||{},t.batches[f]||(d={key:f,events:[],data:[]},t.batches[f]={batched:d,batchFn:s(function(){var n=t.batches[f].batched,r={collector:e,config:o,data:void 0,mapping:l,env:E(t.env,o.env),logger:c};c.debug("push batch",{events:n.events.length}),m(t.pushBatch,"DestinationPushBatch",e.hooks)(n,r),c.debug("push batch done"),n.events=[],n.data=[]},l.batch)}),(_=t.batches[f]).batched.events.push(a.event),n(a.data)&&_.batched.data.push(a.data),_.batchFn(),[3,4]):[3,2]);case 2:return c.debug("push",{event:a.event.name}),[4,m(t.push,"DestinationPush",e.hooks)(a.event,u)];case 3:g.sent(),c.debug("push done"),g.label=4;case 4:return[2,!0]}})})()},O=function(t){var n;return e({ok:!(null==t||null===(n=t.failed)||void 0===n?void 0:n.length),successful:[],queued:[],failed:[]},t)},S=function(e){return _async_to_generator(function(e){var t,n,r,o,a,i,c,s,u,l,f,d,_,g,v,p,y,m,b=arguments;return _ts_generator(this,function(e){t=b.length>1&&void 0!==b[1]?b[1]:{},n={},r=!0,o=!1,a=void 0;try{for(i=Object.entries(t)[Symbol.iterator]();!(r=(c=i.next()).done);r=!0)s=_sliced_to_array(c.value,2),u=s[0],l=s[1],f=l.code,d=l.config,_=void 0===d?{}:d,g=l.env,v=void 0===g?{}:g,p=h(f),y=_object_spread({},p.config,_),m=E(p.env,v),n[u]=_object_spread_props(_object_spread({},p),{config:y,env:m})}catch(e){o=!0,a=e}finally{try{r||null==i.return||i.return()}finally{if(o)throw a}}return[2,n]})}).apply(this,arguments)},E=function(e,t){return e||t?t?e&&r(e)&&r(t)?_object_spread({},e,t):t:e:{}},x=function(e,t,n,r){var o,a,i,c,s=n||[];switch(n||(s=e.on[t]||[]),t){case et.Commands.Consent:o=r||e.consent;break;case et.Commands.Session:o=e.session;break;case et.Commands.Ready:case et.Commands.Run:default:o=void 0}if(Object.values(e.sources).forEach(function(e){e.on&&_(e.on)(t,o)}),Object.values(e.destinations).forEach(function(n){if(n.on){var r=n.type||"unknown",a=e.logger.scope(r).scope("on").scope(t),i={collector:e,config:n.config,data:o,env:E(n.env,n.config.env),logger:a};_(n.on)(t,i)}}),s.length)switch(t){case et.Commands.Consent:a=e,i=s,c=r||a.consent,i.forEach(function(e){Object.keys(c).filter(function(t){return t in e}).forEach(function(t){_(e[t])(a,c)})});break;case et.Commands.Ready:case et.Commands.Run:!function(e,t){e.allowed&&t.forEach(function(t){_(t)(e)})}(e,s);break;case et.Commands.Session:!function(e,t){e.session&&t.forEach(function(t){_(t)(e,e.session)})}(e,s)}},C=function(t,n){return _async_to_generator(function(){var r,o,a;return _ts_generator(this,function(i){return r=t.consent,o=!1,a={},[2,(Object.entries(n).forEach(function(e){var t=_sliced_to_array(e,2),n=t[0],r=!!t[1];a[n]=r,o=o||r}),t.consent=e(r,a),x(t,"consent",void 0,a),o?w(t):O({ok:!0}))]})})()},A=function(n,a,i,c){return _async_to_generator(function(){var s,u;return _ts_generator(this,function(l){switch(l.label){case 0:switch(a){case et.Commands.Config:return[3,1];case et.Commands.Consent:return[3,2];case et.Commands.Custom:return[3,5];case et.Commands.Destination:return[3,6];case et.Commands.Globals:return[3,9];case et.Commands.On:return[3,10];case et.Commands.Ready:return[3,11];case et.Commands.Run:return[3,12];case et.Commands.Session:return[3,14];case et.Commands.User:return[3,15]}return[3,16];case 1:return r(i)&&e(n.config,i,{shallow:!1}),[3,16];case 2:return r(i)?[4,C(n,i)]:[3,4];case 3:s=l.sent(),l.label=4;case 4:return[3,16];case 5:return r(i)&&(n.custom=e(n.custom,i)),[3,16];case 6:return u=r(i)&&function(e){return"function"==typeof e}(i.push),u?[4,b(n,{code:i},c)]:[3,8];case 7:u=s=l.sent(),l.label=8;case 8:return[3,16];case 9:return r(i)&&(n.globals=e(n.globals,i)),[3,16];case 10:return o(i)&&function(e,n,r){var o=e.on,a=o[n]||[],i=t(r)?r:[r];i.forEach(function(e){a.push(e)}),o[n]=a,x(e,n,i)}(n,i,c),[3,16];case 11:return x(n,"ready"),[3,16];case 12:return[4,P(n,i)];case 13:return s=l.sent(),[3,16];case 14:return x(n,"session"),[3,16];case 15:r(i)&&e(n.user,i,{shallow:!1}),l.label=16;case 16:return[2,s||{ok:!0,successful:[],queued:[],failed:[]}]}})})()},P=function(t,n){return _async_to_generator(function(){var r;return _ts_generator(this,function(o){switch(o.label){case 0:return t.allowed=!0,t.count=0,t.group=c(),t.timing=Date.now(),n&&(n.consent&&(t.consent=e(t.consent,n.consent)),n.user&&(t.user=e(t.user,n.user)),n.globals&&(t.globals=e(t.config.globalsStatic||{},n.globals)),n.custom&&(t.custom=e(t.custom,n.custom))),Object.values(t.destinations).forEach(function(e){e.queue=[]}),t.queue=[],t.round++,[4,w(t)];case 1:return r=o.sent(),[2,(x(t,"run"),r)]}})})()},L=function(e,t){return m(function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return _async_to_generator(function(){return _ts_generator(this,function(o){switch(o.label){case 0:return[4,g(function(){return _async_to_generator(function(){var o,a,c,s;return _ts_generator(this,function(u){switch(u.label){case 0:return o=n,r.mapping?[4,y(o,r.mapping,e)]:[3,2];case 1:if((a=u.sent()).ignore)return[2,O({ok:!0})];if(r.mapping.consent&&!i(r.mapping.consent,e.consent,a.event.consent))return[2,O({ok:!0})];o=a.event,u.label=2;case 2:return c=t(o),s=function(e,t){if(!t.name)throw new Error("Event name is required");var n=_sliced_to_array(t.name.split(" "),2),r=n[0],o=n[1];if(!r||!o)throw new Error("Event name is invalid");++e.count;var a=t.timestamp,i=void 0===a?Date.now():a,c=t.group,s=void 0===c?e.group:c,u=t.count,l=void 0===u?e.count:u,f=t.name,d=void 0===f?"".concat(r," ").concat(o):f,_=t.data,g=void 0===_?{}:_,v=t.context,p=void 0===v?{}:v,y=t.globals,m=void 0===y?e.globals:y,h=t.custom,b=void 0===h?{}:h,w=t.user,j=void 0===w?e.user:w,k=t.nested,O=void 0===k?[]:k,S=t.consent,E=void 0===S?e.consent:S,x=t.id,C=void 0===x?"".concat(i,"-").concat(s,"-").concat(l):x,A=t.trigger,P=void 0===A?"":A,L=t.entity,R=void 0===L?r:L,q=t.action,I=void 0===q?o:q,U=t.timing,D=void 0===U?0:U,N=t.version,T=void 0===N?{source:e.version,tagging:e.config.tagging||0}:N,W=t.source;return{name:d,data:g,context:p,globals:m,custom:b,user:j,nested:O,consent:E,id:C,trigger:P,entity:R,action:I,timestamp:i,timing:D,group:s,count:l,version:T,source:void 0===W?{type:"collector",id:"",previous_id:""}:W}}(e,c),[4,w(e,s)];case 3:return[2,u.sent()]}})})()},function(){return O({ok:!1})})()];case 1:return[2,o.sent()]}})})()},"Push",e.hooks)},R=function(t){return _async_to_generator(function(){var n,r,o,a,i,c,s;return _ts_generator(this,function(u){switch(u.label){case 0:return o=e({globalsStatic:{},sessionStatic:{},tagging:0,run:!0},t,{merge:!1,extend:!1}),a={level:null===(n=t.logger)||void 0===n?void 0:n.level,handler:null===(r=t.logger)||void 0===r?void 0:r.handler},i=f(a),c=_object_spread({},o.globalsStatic,t.globals),(s={allowed:!1,config:o,consent:t.consent||{},count:0,custom:t.custom||{},destinations:{},globals:c,group:"",hooks:{},logger:i,on:{},queue:[],round:0,session:void 0,timing:Date.now(),user:t.user||{},version:"0.6.0",sources:{},push:void 0,command:void 0}).push=L(s,function(e){return _object_spread({timing:Math.round((Date.now()-s.timing)/10)/100,source:{type:"collector",id:"",previous_id:""}},e)}),s.command=(d=A,m(function(e,t,n){return _async_to_generator(function(){return _ts_generator(this,function(r){switch(r.label){case 0:return[4,g(function(){return _async_to_generator(function(){return _ts_generator(this,function(r){switch(r.label){case 0:return[4,d(l,e,t,n)];case 1:return[2,r.sent()]}})})()},function(){return O({ok:!1})})()];case 1:return[2,r.sent()]}})})()},"Command",(l=s).hooks)),[4,S(0,t.destinations||{})];case 1:return[2,(s.destinations=u.sent(),s)]}var l,d})})()},q=function(e){return _async_to_generator(function(e){var t,n,r,o,a,i,c,s,u,l=arguments;return _ts_generator(this,function(f){switch(f.label){case 0:t=l.length>1&&void 0!==l[1]?l[1]:{},n={},r=!0,o=!1,a=void 0,f.label=1;case 1:f.trys.push([1,6,7,8]),i=function(){var t,r,o,a,i,c,u,l,f,d,_,v,p,y,m;return _ts_generator(this,function(h){switch(h.label){case 0:return t=_sliced_to_array(s.value,2),r=t[0],o=t[1],a=o.code,i=o.config,c=void 0===i?{}:i,u=o.env,l=void 0===u?{}:u,f=o.primary,d=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.push(t,_object_spread_props(_object_spread({},n),{mapping:c}))},_=e.logger.scope("source").scope(r),v=_object_spread({push:d,command:e.command,sources:e.sources,elb:e.sources.elb.push,logger:_},l),[4,g(a)(c,v)];case 1:return(p=h.sent())?(y=p.type||"unknown",m=e.logger.scope(y).scope(r),v.logger=m,f&&(p.config=_object_spread_props(_object_spread({},p.config),{primary:f})),n[r]=p,[2]):[2,"continue"]}})},c=Object.entries(t)[Symbol.iterator](),f.label=2;case 2:return(r=(s=c.next()).done)?[3,5]:[5,_ts_values(i())];case 3:f.sent(),f.label=4;case 4:return r=!0,[3,2];case 5:return[3,8];case 6:return u=f.sent(),o=!0,a=u,[3,8];case 7:try{r||null==c.return||c.return()}finally{if(o)throw a}return[7];case 8:return[2,n]}})}).apply(this,arguments)},I=function(e,t){return(e.getAttribute(t)||"").trim()},U=function(e){var t,n=getComputedStyle(e);if("none"===n.display)return!1;if("visible"!==n.visibility)return!1;if(n.opacity&&Number(n.opacity)<.1)return!1;var r=window.innerHeight,o=e.getBoundingClientRect(),a=o.height,i=o.y,c=i+a,s={x:o.x+e.offsetWidth/2,y:o.y+e.offsetHeight/2};if(a<=r){if(e.offsetWidth+o.width===0||e.offsetHeight+o.height===0)return!1;if(s.x<0)return!1;if(s.x>(document.documentElement.clientWidth||window.innerWidth))return!1;if(s.y<0)return!1;if(s.y>(document.documentElement.clientHeight||window.innerHeight))return!1;t=document.elementFromPoint(s.x,s.y)}else{var u=r/2;if(i<0&&c<u)return!1;if(c>r&&i>u)return!1;t=document.elementFromPoint(s.x,r/2)}if(t)do{if(t===e)return!0}while(t=t.parentElement);return!1},D=function(e,t,n){return!1===n?e:(n||(n=rt),n(e,t,rt))},N=function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Fe.Utils.Storage.Session;function o(e){try{return JSON.parse(e||"")}catch(r){var t=1,n="";return e&&(t=0,n=e),{e:t,v:n}}}switch(r){case Fe.Utils.Storage.Cookie:var a;t=decodeURIComponent((null===(a=document.cookie.split("; ").find(function(t){return t.startsWith(e+"=")}))||void 0===a?void 0:a.split("=")[1])||"");break;case Fe.Utils.Storage.Local:n=o(window.localStorage.getItem(e));break;case Fe.Utils.Storage.Session:n=o(window.sessionStorage.getItem(e))}return n&&(t=n.v,0!=n.e&&n.e<Date.now()&&(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Fe.Utils.Storage.Session;switch(t){case Fe.Utils.Storage.Cookie:T(e,"",0,t);break;case Fe.Utils.Storage.Local:window.localStorage.removeItem(e);break;case Fe.Utils.Storage.Session:window.sessionStorage.removeItem(e)}}(e,r),t="")),function(e){if("true"===e)return!0;if("false"===e)return!1;var t=Number(e);return e==t&&""!==e?t:String(e)}(t||"")},T=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:30,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Fe.Utils.Storage.Session,o=arguments.length>4?arguments[4]:void 0,a={e:Date.now()+6e4*n,v:String(t)},i=JSON.stringify(a);switch(r){case Fe.Utils.Storage.Cookie:t="object"==(void 0===t?"undefined":_type_of(t))?JSON.stringify(t):t;var c="".concat(e,"=").concat(encodeURIComponent(t),"; max-age=").concat(60*n,"; path=/; SameSite=Lax; secure");o&&(c+="; domain="+o),document.cookie=c;break;case Fe.Utils.Storage.Local:window.localStorage.setItem(e,i);break;case Fe.Utils.Storage.Session:window.sessionStorage.setItem(e,i)}return N(e,r)},W=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=Date.now(),n=e.length,r=void 0===n?30:n,o=e.deviceKey,a=void 0===o?"elbDeviceId":o,i=e.deviceStorage,s=void 0===i?"local":i,u=e.deviceAge,l=void 0===u?30:u,f=e.sessionKey,d=void 0===f?"elbSessionId":f,g=e.sessionStorage,v=void 0===g?"local":g,p=e.pulse,y=void 0!==p&&p,m=X(e),h=!1,b=_(function(e,t,n){var r=N(e,n);return r||(r=c(8),T(e,r,1440*t,n)),String(r)})(a,l,s),w=_(function(e,n){var o=JSON.parse(String(N(e,n)));return y||(o.isNew=!1,m.marketing&&(Object.assign(o,m),h=!0),h||o.updated+6e4*r<t?(delete o.id,delete o.referrer,o.start=t,o.count++,o.runs=1,h=!0):o.runs++),o},function(){h=!0})(d,v)||{},j={id:c(12),start:t,isNew:!0,count:1,runs:1},k=Object.assign(j,m,w,{device:b},{isStart:h,storage:!0,updated:t},e.data);return T(d,JSON.stringify(k),2*r,v),k},X=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.isStart||!1,r={isStart:n,storage:!1};if(!1===t.isStart)return r;if(!n&&"navigate"!==_sliced_to_array(performance.getEntriesByType("navigation"),1)[0].type)return r;var o=new URL(t.url||window.location.href),a=t.referrer||document.referrer,i=a&&new URL(a).hostname,s=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="clickId",o={},a={utm_campaign:"campaign",utm_content:"content",utm_medium:"medium",utm_source:"source",utm_term:"term",dclid:r,fbclid:r,gclid:r,msclkid:r,ttclid:r,twclid:r,igshid:r,sclid:r};return Object.entries(e(a,n)).forEach(function(e){var n=_sliced_to_array(e,2),a=n[0],i=n[1],c=t.searchParams.get(a);c&&(i===r&&(i=a,o[r]=a),o[i]=c)}),o}(o,t.parameters);if(Object.keys(s).length&&(s.marketing||(s.marketing=!0),n=!0),!n){var u=t.domains||[];u.push(o.hostname),n=!u.includes(i)}return n?Object.assign({isStart:n,storage:!1,start:Date.now(),id:c(12),referrer:i},s,t.data):r},B=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n=_object_spread({},st,n);var r=Object.entries(t).reduce(function(t,r){var o=_sliced_to_array(r,2),a=o[0],i=o[1],c=e[a];return n.merge&&Array.isArray(c)&&Array.isArray(i)?t[a]=i.reduce(function(e,t){return e.includes(t)?e:_to_consumable_array(e).concat([t])},_to_consumable_array(c)):(n.extend||a in e)&&(t[a]=i),t},{});return n.shallow?_object_spread({},e,r):(Object.assign(e,r),e)},G=function(e){return Array.isArray(e)},M=function(e){return e===document||_instanceof(e,Element)},K=function(e){return"object"==(void 0===e?"undefined":_type_of(e))&&null!==e&&!G(e)&&"[object Object]"===Object.prototype.toString.call(e)},F=function(e){return"string"==typeof e},H=function(e){if("true"===e)return!0;if("false"===e)return!1;var t=Number(e);return e==t&&""!==e?t:String(e)},J=function(e,t,n){return function(){for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];try{return e.apply(void 0,_to_consumable_array(o))}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}},z=function(e){return e?e.trim().replace(/^'|'$/g,"").trim():""},Y=function(e,t){return e+(null!=t?(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?"-":"")+t:"")},V=function(e,t,n){return ie(I(t,Y(e,n,!(arguments.length>3&&void 0!==arguments[3])||arguments[3]))||"").reduce(function(e,n){var r=_sliced_to_array(ce(n),2),o=r[0],a=r[1];if(!o)return e;if(a||(o.endsWith(":")&&(o=o.slice(0,-1)),a=""),a.startsWith("#")){a=a.slice(1);try{var i=t[a];i||"selected"!==a||(i=t.options[t.selectedIndex].text),a=String(i)}catch(i){a=""}}return o.endsWith("[]")?(o=o.slice(0,-2),G(e[o])||(e[o]=[]),e[o].push(H(a))):e[o]=H(a),e},{})},$=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:et.Commands.Prefix,r=e||document.body;if(!r)return[];var o=[],a=et.Commands.Action,i="[".concat(Y(n,a,!1),"]"),c=function(e){Object.keys(V(n,e,a,!1)).forEach(function(t){o=o.concat(Q(e,t,n))})};return r!==document&&(null==(t=r.matches)?void 0:t.call(r,i))&&c(r),ae(r,i,c),o},Q=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:et.Commands.Prefix,r=[],o=function(e,t,n){for(var r=t;r;){var o=I(r,Y(e,et.Commands.Actions,!1));if(o){var a=te(o);if(a[n])return{actions:a[n],nearestOnly:!1}}var i=I(r,Y(e,et.Commands.Action,!1));if(i){var c=te(i);if(c[n]||"click"!==n)return{actions:c[n]||[],nearestOnly:!0}}r=re(e,r)}return{actions:[],nearestOnly:!1}}(n,e,t),a=o.actions,i=o.nearestOnly;return a.length?(a.forEach(function(o){var a=ie(o.actionParams||"",",").reduce(function(e,t){return e[z(t)]=!0,e},{}),c=ne(n,e,a,i);if(!c.length){var s="page",u="[".concat(Y(n,s),"]"),l=_sliced_to_array(oe(e,u,n,s),2),f=l[0],d=l[1];c.push({entity:s,data:f,nested:[],context:d})}c.forEach(function(e){r.push({entity:e.entity,action:o.action,data:e.data,trigger:t,context:e.context,nested:e.nested})})}),r):r},Z=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:et.Commands.Prefix,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document,n=Y(e,et.Commands.Globals,!1),r={};return ae(t,"[".concat(n,"]"),function(t){r=B(r,V(e,t,et.Commands.Globals,!1))}),r},ee=function(e,t){var n=window.location,r="page",o=t===document?document.body:t,a=_sliced_to_array(oe(o,"[".concat(Y(e,r),"]"),e,r),2),i=a[0],c=a[1];return i.domain=n.hostname,i.title=document.title,i.referrer=document.referrer,n.search&&(i.search=n.search),n.hash&&(i.hash=n.hash),[i,c]},te=function(e){var t={};return ie(e).forEach(function(e){var n=_sliced_to_array(ce(e),2),r=n[0],o=n[1],a=_sliced_to_array(se(r),2),i=a[0],c=a[1];if(i){var s=_sliced_to_array(se(o||""),2),u=s[0],l=s[1];u=u||i,t[i]||(t[i]=[]),t[i].push({trigger:i,triggerParams:c,action:u,actionParams:l})}}),t},ne=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=[],a=t;for(n=0!==Object.keys(n||{}).length?n:void 0;a;){var i=ut(e,a,t,n);if(i&&(o.push(i),r))break;a=re(e,a)}return o},re=function(e,t){var n=Y(e,et.Commands.Link,!1);if(t.matches("[".concat(n,"]"))){var r=_sliced_to_array(ce(I(t,n)),2),o=r[0];if("child"===r[1])return document.querySelector("[".concat(n,'="').concat(o,':parent"]'))}return!t.parentElement&&t.getRootNode&&_instanceof(t.getRootNode(),ShadowRoot)?t.getRootNode().host:t.parentElement},oe=function(e,t,n,r){for(var o={},a={},i=e,c="[".concat(Y(n,et.Commands.Context,!1),"]"),s=0;i;)i.matches(t)&&(o=B(V(n,i,""),o),o=B(V(n,i,r),o)),i.matches(c)&&(Object.entries(V(n,i,et.Commands.Context,!1)).forEach(function(e){var t=_sliced_to_array(e,2),n=t[0],r=t[1];r&&!a[n]&&(a[n]=[r,s])}),++s),i=re(n,i);return[o,a]},ae=function(e,t,n){e.querySelectorAll(t).forEach(n)},ie=function(e){if(!e)return[];var t=new RegExp("(?:[^".concat(arguments.length>1&&void 0!==arguments[1]?arguments[1]:";","']+|'[^']*')+"),"ig");return e.match(t)||[]},ce=function(e){var t=_sliced_to_array(e.split(/:(.+)/,2),2),n=t[0],r=t[1];return[z(n),z(r)]},se=function(e){var t=_sliced_to_array(e.split("(",2),2),n=t[0],r=t[1];return[n,r?r.slice(0,-1):""]},ue=function(e){var t=Date.now(),n=dt.get(e);return(!n||t-n.lastChecked>500)&&(n={isVisible:U(e),lastChecked:t},dt.set(e,n)),n.isVisible},le=function(e){if(window.IntersectionObserver)return J(function(){return new window.IntersectionObserver(function(t){t.forEach(function(t){!function(e,t){var n,r,o=t.target,a=_t.get(e);if(a){var i=a.timers.get(o);if(t.intersectionRatio>0){var c=Date.now(),s=ft.get(o);if((!s||c-s.lastChecked>1e3)&&(s={isLarge:o.offsetHeight>window.innerHeight,lastChecked:c},ft.set(o,s)),t.intersectionRatio>=.5||s.isLarge&&ue(o)){var u=null==(n=a.elementConfigs)?void 0:n.get(o);if((null==u?void 0:u.multiple)&&u.blocked)return;if(!i){var l=window.setTimeout(function(){return _async_to_generator(function(){var t,n,r,i;return _ts_generator(this,function(c){switch(c.label){case 0:return ue(o)?(r=null==(t=a.elementConfigs)?void 0:t.get(o),(null==r?void 0:r.context)?[4,ye(r.context,o,r.trigger)]:[3,2]):[3,3];case 1:c.sent(),c.label=2;case 2:(null==(i=null==(n=a.elementConfigs)?void 0:n.get(o))?void 0:i.multiple)?i.blocked=!0:function(e,t){var n=_t.get(e);if(n){n.observer&&n.observer.unobserve(t);var r=n.timers.get(t);r&&(clearTimeout(r),n.timers.delete(t)),ft.delete(t),dt.delete(t)}}(e,o),c.label=3;case 3:return[2]}})})()},a.duration);a.timers.set(o,l)}return}}i&&(clearTimeout(i),a.timers.delete(o));var f=null==(r=a.elementConfigs)?void 0:r.get(o);(null==f?void 0:f.multiple)&&(f.blocked=!1)}}(e,t)})},{rootMargin:"0px",threshold:[0,.5]})},function(){})()},fe=function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{multiple:!1},o=e.settings.scope||document,a=_t.get(o);(null==a?void 0:a.observer)&&t&&(a.elementConfigs||(a.elementConfigs=new WeakMap),a.elementConfigs.set(t,{multiple:null!=(n=r.multiple)&&n,blocked:!1,context:e,trigger:r.multiple?"visible":"impression"}),a.observer.observe(t))},de=function(e){if(e){var t=_t.get(e);t&&(t.observer&&t.observer.disconnect(),_t.delete(e))}},_e=function(e,t,n,r,o,a,i){var c=e.elb,s=e.settings;if(F(t)&&t.startsWith("walker "))return c(t,n);if(K(t)){var u=t;return u.source||(u.source=ge()),u.globals||(u.globals=Z(s.prefix,s.scope||document)),c(u)}var l,f=_sliced_to_array(String(K(t)?t.name:t).split(" "),1)[0],d=K(n)?n:{},_={},g=!1;if(M(n)&&(l=n,g=!0),M(o)?l=o:K(o)&&Object.keys(o).length&&(_=o),l){var v=ne(s.prefix||"data-elb",l).find(function(e){return e.entity===f});v&&(g&&(d=v.data),_=v.context)}"page"===f&&(d.id=d.id||window.location.pathname);var p=Z(s.prefix,s.scope);return c({name:String(t||""),data:d,context:_,globals:p,nested:a,custom:i,trigger:F(r)?r:"",source:ge()})},ge=function(){return{type:"browser",id:window.location.href,previous_id:document.referrer}},ve=function(e,t){var n,r;t.scope&&(n=e,(r=t.scope)&&(r.addEventListener("click",J(function(e){he.call(this,n,e)})),r.addEventListener("submit",J(function(e){be.call(this,n,e)}))))},pe=function(e,t){t.scope&&function(e,t){var n=t.scope;gt=[];var r=n||document;de(r),function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;_t.has(e)||_t.set(e,{observer:le(e),timers:new WeakMap,duration:t})}(r,1e3);var o,a,i,c=Y(t.prefix,et.Commands.Action,!1);r!==document&&me(e,r,c,t),r.querySelectorAll("[".concat(c,"]")).forEach(function(n){me(e,n,c,t)}),gt.length&&(o=e,a=r,i=function(e,t){return e.filter(function(e){var n=_sliced_to_array(e,2),r=n[0],o=n[1],a=window.scrollY+window.innerHeight,i=r.offsetTop;if(a<i)return!0;var c=r.clientHeight;return!(100*(1-(i+c-a)/(c||1))>=o&&(ye(t,r,ht),1))})},lt||(lt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,n=null;return function(){for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];if(null===n)return n=setTimeout(function(){n=null},t),e.apply(void 0,_to_consumable_array(o))}}(function(){gt=i.call(a,gt,o)}),a.addEventListener("scroll",lt)))}(e,t)},ye=function(e,t,n){return _async_to_generator(function(){var r;return _ts_generator(this,function(o){return r=Q(t,n,e.settings.prefix),[2,Promise.all(r.map(function(t){return _e(e,_object_spread_props(_object_spread({name:"".concat(t.entity," ").concat(t.action)},t),{trigger:n}))}))]})})()},me=function(e,t,n,r){var o=I(t,n);o&&Object.values(te(o)).forEach(function(n){return n.forEach(function(n){switch(n.trigger){case pt:r=e,t.addEventListener("mouseenter",J(function(e){_instanceof(e.target,Element)&&ye(r,e.target,pt)}));break;case yt:!function(e,t){ye(e,t,yt)}(e,t);break;case mt:!function(e,t){setInterval(function(){document.hidden||ye(e,t,mt)},parseInt((arguments.length>2&&void 0!==arguments[2]?arguments[2]:"")||"")||15e3)}(e,t,n.triggerParams);break;case ht:!function(e){var t=parseInt((arguments.length>1&&void 0!==arguments[1]?arguments[1]:"")||"")||50;t<0||t>100||gt.push([e,t])}(t,n.triggerParams);break;case wt:fe(e,t);break;case jt:fe(e,t,{multiple:!0});break;case kt:!function(e,t){setTimeout(function(){return ye(e,t,kt)},parseInt((arguments.length>2&&void 0!==arguments[2]?arguments[2]:"")||"")||15e3)}(e,t,n.triggerParams)}var r})})},he=function(e,t){ye(e,t.target,vt)},be=function(e,t){t.target&&ye(e,t.target,bt)},we=function(e,t,n,r){var o=[],a=!0;n.forEach(function(e){var t,n=ke(e)?_to_consumable_array(Array.from(e)):null!=(t=e)&&"object"==(void 0===t?"undefined":_type_of(t))&&"length"in t&&"number"==typeof t.length?Array.from(e):[e];if((!Array.isArray(n)||0!==n.length)&&(!Array.isArray(n)||1!==n.length||n[0])){var i=n[0],c=!K(i)&&F(i)&&i.startsWith("walker ");if(K(i)){if("object"==(void 0===i?"undefined":_type_of(i))&&0===Object.keys(i).length)return}else{var s=Array.from(n);if(!F(s[0])||""===s[0].trim())return;a&&"walker run"===s[0]&&(a=!1)}(r&&c||!r&&!c)&&o.push(n)}}),o.forEach(function(n){je(e,t,n)})},je=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"data-elb",n=arguments.length>2?arguments[2]:void 0;J(function(){if(Array.isArray(n)){var r=_to_array(n),o=r[0],a=r.slice(1);if(!o||F(o)&&""===o.trim())return;if(F(o)&&o.startsWith("walker "))return void e(o,a[0]);_e.apply(void 0,[{elb:e,settings:{prefix:t,scope:document,pageview:!1,session:!1,elb:"",elbLayer:!1}},o].concat(_to_consumable_array(a)))}else if(n&&"object"==(void 0===n?"undefined":_type_of(n))){if(0===Object.keys(n).length)return;e(n)}},function(){})()},ke=function(e){return null!=e&&"object"==(void 0===e?"undefined":_type_of(e))&&"[object Arguments]"===Object.prototype.toString.call(e)},Oe=function(e){var r=arguments.length>2?arguments[2]:void 0;return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.cb,o=e.consent,a=e.collector,c=e.storage;if(!o)return D((c?W:X)(e),a,r);var s,u,l,f=(s=e,u=r,function(e,r){if(!n(l)||l!==(null==e?void 0:e.group)){l=null==e?void 0:e.group;var o=function(){return X(s)};if(s.consent){var a=(t(s.consent)?s.consent:[s.consent]).reduce(function(e,t){return _object_spread_props(_object_spread({},e),_define_property({},t,!0))},{});i(a,r)&&(o=function(){return W(s)})}return D(o(),e,u)}}),d=(t(o)?o:[o]).reduce(function(e,t){return _object_spread_props(_object_spread({},e),_define_property({},t,f))},{});a?a.command("on","consent",d):nt("walker on","consent",d)}(_object_spread_props(_object_spread({},arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),{collector:{push:e,group:void 0,command:r}}))},Se=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2?arguments[2]:void 0;if(!n.filter||!0!==_(function(){return n.filter(a)},function(){return!1})()){var i,c,s=r(i=a)&&o(i.event)?_object_spread({name:i.event},_object_without_properties(i,["event"])):t(i)&&i.length>=2?Ee(i):null!=(c=i)&&"object"==(void 0===c?"undefined":_type_of(c))&&"length"in c&&"number"==typeof c.length&&c.length>0?Ee(Array.from(i)):null;if(s){var u="".concat(n.prefix||"dataLayer"," ").concat(s.name),l=(s.name,{name:u,data:_object_without_properties(s,["name"])});_(function(){return e(l)},function(){})()}}},Ee=function(e){var t=_sliced_to_array(e,3),n=t[0],a=t[1],i=t[2];if(!o(n))return null;var c,s={};switch(n){case"consent":if(!o(a)||e.length<3)return null;if("default"!==a&&"update"!==a)return null;if(!r(i)||null===i)return null;c="".concat(n," ").concat(a),s=_object_spread({},i);break;case"event":if(!o(a))return null;c=a,r(i)&&(s=_object_spread({},i));break;case"config":if(!o(a))return null;c="".concat(n," ").concat(a),r(i)&&(s=_object_spread({},i));break;case"set":if(o(a))c="".concat(n," ").concat(a),r(i)&&(s=_object_spread({},i));else{if(!r(a))return null;c="".concat(n," custom"),s=_object_spread({},a)}break;default:return null}return _object_spread({name:c},s)},xe=function(){return["consent","update",{ad_user_data:"granted",ad_personalization:"granted",ad_storage:"denied",analytics_storage:"granted"}]},Ce=function(){return["consent","default",{ad_storage:"denied",analytics_storage:"denied",ad_user_data:"denied",ad_personalization:"denied"}]},Ae=function(){return["event","purchase",{transaction_id:"T_12345",value:25.42,currency:"EUR",items:[{item_id:"SKU_12345",item_name:"Product Name",item_category:"Category",quantity:1,price:25.42}]}]},Pe=function(){return["event","add_to_cart",{currency:"EUR",value:15.25,items:[{item_id:"SKU_12345",item_name:"Product Name",item_variant:"red",quantity:1,price:15.25}]}]},Le=function(){return["event","view_item",{currency:"EUR",value:15.25,items:[{item_id:"SKU_12345",item_name:"Product Name",item_category:"Category",price:15.25}]}]},Re=function(){return["config","G-XXXXXXXXXX",{page_title:"Custom Page Title",page_location:"https://example.com/page",send_page_view:!1}]},qe=function(){return["set",{currency:"EUR",country:"DE"}]},Ie=function(){return{event:"custom_event",custom_parameter:"custom_value",user_id:"user123"}},Ue=function(){window.dataLayer=window.dataLayer||[];var e=function(e){r(e)&&r(e.source)&&String(e.source.type).includes("dataLayer")||window.dataLayer.push(e)};return{type:"dataLayer",config:{},push:function(t,n){e(n.data||t)},pushBatch:function(t){e({name:"batch",batched_event:t.key,events:t.data.length?t.data:t.events})}}},De=function(){return _async_to_generator(function(){var t,n,o,a,i,c,s=arguments;return _ts_generator(this,function(u){switch(u.label){case 0:return t=s.length>0&&void 0!==s[0]?s[0]:{},n={collector:{destinations:{dataLayer:{code:Ue()}}},browser:{session:!0},dataLayer:!1,elb:"elb",run:!0},o=e(n,t),a=_object_spread_props(_object_spread({},o.collector),{sources:{browser:{code:At,config:{settings:o.browser},env:{window:"undefined"!=typeof window?window:void 0,document:"undefined"!=typeof document?document:void 0}}}}),o.dataLayer&&(i=r(o.dataLayer)?o.dataLayer:{},a.sources&&(a.sources.dataLayer={code:Ht,config:{settings:i}})),[4,(l=a,_async_to_generator(function(){var e,t,n,r,o,a,i,c,s,u,f;return _ts_generator(this,function(d){switch(d.label){case 0:return[4,R(l=l||{})];case 1:return e=d.sent(),n=e,t={type:"elb",config:{},push:function(e,t,r,o,a,i){return _async_to_generator(function(){var c,s;return _ts_generator(this,function(u){if("string"==typeof e&&e.startsWith("walker "))return c=e.replace("walker ",""),[2,n.command(c,t,r)];if("string"==typeof e)s={name:e},t&&"object"==(void 0===t?"undefined":_type_of(t))&&!Array.isArray(t)&&(s.data=t);else{if(!e||"object"!=(void 0===e?"undefined":_type_of(e)))return[2,{ok:!1,successful:[],queued:[],failed:[]}];s=e,t&&"object"==(void 0===t?"undefined":_type_of(t))&&!Array.isArray(t)&&(s.data=_object_spread({},s.data||{},t))}return[2,(o&&"object"==(void 0===o?"undefined":_type_of(o))&&(s.context=o),a&&Array.isArray(a)&&(s.nested=a),i&&"object"==(void 0===i?"undefined":_type_of(i))&&(s.custom=i),n.push(s))]})})()}},e.sources.elb=t,[4,q(e,l.sources||{})];case 2:return r=d.sent(),Object.assign(e.sources,r),o=l.consent,a=l.user,i=l.globals,c=l.custom,o?[4,e.command("consent",o)]:[3,4];case 3:d.sent(),d.label=4;case 4:return a?[4,e.command("user",a)]:[3,6];case 5:d.sent(),d.label=6;case 6:return i&&Object.assign(e.globals,i),c&&Object.assign(e.custom,c),e.config.run?[4,e.command("run")]:[3,8];case 7:d.sent(),d.label=8;case 8:return s=t.push,u=Object.values(e.sources).filter(function(e){return"elb"!==e.type}),[2,((f=u.find(function(e){return e.config.primary}))?s=f.push:u.length>0&&(s=u[0].push),{collector:e,elb:s})]}})})())];case 1:return c=u.sent(),"undefined"!=typeof window&&(o.elb&&(window[o.elb]=c.elb),o.name&&(window[o.name]=c.collector)),[2,c]}var l})}).apply(this,arguments)},Ne=Object.defineProperty,Te=Object.getOwnPropertyDescriptor,We=Object.getOwnPropertyNames,Xe=Object.prototype.hasOwnProperty,Be={};!function(e,t){for(var n in t)Ne(e,n,{get:t[n],enumerable:!0})}(Be,{Walkerjs:function(){return Jt},createWalkerjs:function(){return De},default:function(){return zt},getAllEvents:function(){return $},getEvents:function(){return Q},getGlobals:function(){return Z}});var Ge=Object.defineProperty;!function(e,t){for(var n in t)Ge(e,n,{get:t[n],enumerable:!0})}({},{Level:function(){return Ke}});var Me,Ke=((Me=Ke||{})[Me.ERROR=0]="ERROR",Me[Me.INFO=1]="INFO",Me[Me.DEBUG=2]="DEBUG",Me),Fe={Utils:{Storage:{Local:"local",Session:"session",Cookie:"cookie"}}},He={merge:!0,shallow:!0,extend:!0};function Je(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new WeakMap;if("object"!=(void 0===e?"undefined":_type_of(e))||null===e)return e;if(t.has(e))return t.get(e);var n=Object.prototype.toString.call(e);if("[object Object]"===n){var r={};for(var o in t.set(e,r),e)Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=Je(e[o],t));return r}if("[object Array]"===n){var a=[];return t.set(e,a),e.forEach(function(e){a.push(Je(e,t))}),a}if("[object Date]"===n)return new Date(e.getTime());if("[object RegExp]"===n){var i=e;return new RegExp(i.source,i.flags)}return e}function ze(e){for(var r=arguments.length>2?arguments[2]:void 0,o=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"").split("."),a=e,i=0;i<o.length;i++){var c=o[i];if("*"===c&&t(a)){var s=o.slice(i+1).join("."),u=[],l=!0,f=!1,d=void 0;try{for(var _,g=a[Symbol.iterator]();!(l=(_=g.next()).done);l=!0){var v=ze(_.value,s,r);u.push(v)}}catch(e){f=!0,d=e}finally{try{l||null==g.return||g.return()}finally{if(f)throw d}}return u}if(!(a=_instanceof(a,Object)?a[c]:void 0))break}return n(a)?a:r}var Ye=function(e,t,n,r){var o="".concat(Ke[e]).concat(r.length>0?" [".concat(r.join(":"),"]"):""),a=Object.keys(n).length>0;0===e?a?console.error(o,t,n):console.error(o,t):a?console.log(o,t,n):console.log(o,t)};function Ve(e){var t=e.level,n=e.handler,r=e.scope,o=function(e,o,a){if(e<=t){var i=l(o,a);n?n(e,i.message,i.context,r,Ye):Ye(e,i.message,i.context,r)}};return{error:function(e,t){return o(0,e,t)},info:function(e,t){return o(1,e,t)},debug:function(e,t){return o(2,e,t)},throw:function(e,t){var o=l(e,t);throw n?n(0,o.message,o.context,r,Ye):Ye(0,o.message,o.context,r),new Error(o.message)},scope:function(e){return Ve({level:t,handler:n,scope:_to_consumable_array(r).concat([e])})}}}function $e(e){return function(e){return"boolean"==typeof e}(e)||o(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!n(e)||t(e)&&e.every($e)||r(e)&&Object.values(e).every($e)}function Qe(e,r){return _async_to_generator(function(e,r){var a,c,s,u=arguments;return _ts_generator(this,function(l){return c=(a=u.length>2&&void 0!==u[2]?u[2]:{}).collector,s=a.consent,[2,(t(r)?r:[r]).reduce(function(r,u){return _async_to_generator(function(){var l,f,_,v,y,m,h,b,w,j,k,O,S,E,x,C,A,P,L,R,q;return _ts_generator(this,function(I){switch(I.label){case 0:return[4,r];case 1:return(l=I.sent())?[2,l]:(f=o(u)?{key:u}:u,Object.keys(f).length?(_=f.condition,v=f.consent,y=f.fn,m=f.key,h=f.loop,b=f.map,w=f.set,j=f.validate,k=f.value,(O=_)?[4,g(_)(e,u,c)]:[3,3]):[2]);case 2:O=!I.sent(),I.label=3;case 3:return O?[2]:v&&!i(v,s)?[2,k]:(S=n(k)?k:e,y?[4,g(y)(e,u,a)]:[3,5]);case 4:S=I.sent(),I.label=5;case 5:return m&&(S=ze(e,m,k)),h?(E=_sliced_to_array(h,2),x=E[0],C=E[1],"this"!==x?[3,6]:(P=[e],[3,8])):[3,11];case 6:return[4,p(e,x,a)];case 7:P=I.sent(),I.label=8;case 8:return t(A=P)?[4,Promise.all(A.map(function(e){return p(e,C,a)}))]:[3,10];case 9:S=I.sent().filter(n),I.label=10;case 10:return[3,17];case 11:return b?[4,Object.entries(b).reduce(function(t,r){var o=_sliced_to_array(r,2),i=o[0],c=o[1];return _async_to_generator(function(){var r,o;return _ts_generator(this,function(s){switch(s.label){case 0:return[4,t];case 1:return r=s.sent(),[4,p(e,c,a)];case 2:return o=s.sent(),[2,(n(o)&&(r[i]=o),r)]}})})()},Promise.resolve({}))]:[3,13];case 12:return S=I.sent(),[3,16];case 13:return(L=w)?[4,Promise.all(w.map(function(t){return Qe(e,t,a)}))]:[3,15];case 14:L=S=I.sent(),I.label=15;case 15:I.label=16;case 16:I.label=17;case 17:return(R=j)?[4,g(j)(S)]:[3,19];case 18:R=!I.sent(),I.label=19;case 19:return R&&(S=void 0),q=d(S),[2,n(q)?q:d(k)]}})})()},Promise.resolve(void 0))]})}).apply(this,arguments)}var Ze,et={Commands:{Action:"action",Actions:"actions",Config:"config",Consent:"consent",Context:"context",Custom:"custom",Destination:"destination",Elb:"elb",Globals:"globals",Hook:"hook",Init:"init",Link:"link",On:"on",Prefix:"data-elb",Ready:"ready",Run:"run",Session:"session",User:"user",Walker:"walker"},Utils:{Storage:{Cookie:"cookie",Local:"local",Session:"session"}}},tt={type:"code",config:{},init:function(e){var t=e.config,n=e.logger,r=t.settings,o=null==r?void 0:r.scripts,a=!0,i=!1,c=void 0;if(o&&"undefined"!=typeof document)try{for(var s,u=o[Symbol.iterator]();!(a=(s=u.next()).done);a=!0){var l=s.value,f=document.createElement("script");f.src=l,f.async=!0,document.head.appendChild(f)}}catch(e){i=!0,c=e}finally{try{a||null==u.return||u.return()}finally{if(i)throw c}}var d=null==r?void 0:r.init;if(d)try{new Function("context",d)(e)}catch(e){n.error("Code destination init error:",e)}},push:function(e,t){var n,r,o=t.mapping,a=t.config,i=t.logger,c=null!==(r=null==o?void 0:o.push)&&void 0!==r?r:null===(n=a.settings)||void 0===n?void 0:n.push;if(c)try{new Function("event","context",c)(e,t)}catch(e){i.error("Code destination push error:",e)}},pushBatch:function(e,t){var n,r,o=t.mapping,a=t.config,i=t.logger,c=null!==(r=null==o?void 0:o.pushBatch)&&void 0!==r?r:null===(n=a.settings)||void 0===n?void 0:n.pushBatch;if(c)try{new Function("batch","context",c)(e,t)}catch(e){i.error("Code destination pushBatch error:",e)}},on:function(e,t){var n,r=t.config,o=t.logger,a=null===(n=r.settings)||void 0===n?void 0:n.on;if(a)try{new Function("type","context",a)(e,t)}catch(e){o.error("Code destination on error:",e)}}},nt=function(){var e=window;(e.elbLayer=e.elbLayer||[]).push(arguments)},rt=function(e,t){var n={};return e.id&&(n.session=e.id),e.storage&&e.device&&(n.device=e.device),t?t.command("user",n):nt("walker user",n),e.isStart&&(t?t.push({name:"session start",data:e}):nt({name:"session start",data:e})),e},ot=Object.defineProperty,at=function(e,t){for(var n in t)ot(e,n,{get:t[n],enumerable:!0})},it=Object.defineProperty;!function(e,t){for(var n in t)it(e,n,{get:t[n],enumerable:!0})}({},{Level:function(){return ct}});var ct=((Ze=ct||{})[Ze.ERROR=0]="ERROR",Ze[Ze.INFO=1]="INFO",Ze[Ze.DEBUG=2]="DEBUG",Ze),st={merge:!0,shallow:!0,extend:!0};function ut(e,t,n,r){var o=I(t,Y(e));if(!o||r&&!r[o])return null;var a=[t],i="[".concat(Y(e,o),"],[").concat(Y(e,""),"]"),c=Y(e,et.Commands.Link,!1),s={},u=[],l=_sliced_to_array(oe(n||t,i,e,o),2),f=l[0],d=l[1];ae(t,"[".concat(c,"]"),function(t){var n=_sliced_to_array(ce(I(t,c)),2),r=n[0];"parent"===n[1]&&ae(document.body,"[".concat(c,'="').concat(r,':child"]'),function(t){a.push(t);var n=ut(e,t);n&&u.push(n)})});var _=[];a.forEach(function(e){e.matches(i)&&_.push(e),ae(e,i,function(e){return _.push(e)})});var g={};return _.forEach(function(t){g=B(g,V(e,t,"")),s=B(s,V(e,t,o))}),s=B(B(g,s),f),a.forEach(function(t){ae(t,"[".concat(Y(e),"]"),function(t){var n=ut(e,t);n&&u.push(n)})}),{entity:o,data:s,context:d,nested:u}}var lt,ft=new WeakMap,dt=new WeakMap,_t=new WeakMap,gt=[],vt="click",pt="hover",yt="load",mt="pulse",ht="scroll",bt="submit",wt="impression",jt="visible",kt="wait";at({},{env:function(){return Ot}});var Ot={};at(Ot,{push:function(){return Ct}});var St=function(){},Et=function(){return function(){return Promise.resolve({ok:!0,successful:[],queued:[],failed:[]})}},xt={error:St,info:St,debug:St,throw:function(e){throw"string"==typeof e?new Error(e):e},scope:function(){return xt}},Ct={get push(){return Et()},get command(){return Et()},get elb(){return Et()},get window(){return{addEventListener:St,removeEventListener:St,location:{href:"https://example.com/page",pathname:"/page",search:"?query=test",hash:"#section",host:"example.com",hostname:"example.com",origin:"https://example.com",protocol:"https:"},document:{},navigator:{language:"en-US",userAgent:"Mozilla/5.0 (Test)"},screen:{width:1920,height:1080},innerWidth:1920,innerHeight:1080,pageXOffset:0,pageYOffset:0,scrollX:0,scrollY:0}},get document(){return{addEventListener:St,removeEventListener:St,querySelector:St,querySelectorAll:function(){return[]},getElementById:St,getElementsByClassName:function(){return[]},getElementsByTagName:function(){return[]},createElement:function(){return{setAttribute:St,getAttribute:St,addEventListener:St,removeEventListener:St}},body:{appendChild:St,removeChild:St},documentElement:{scrollTop:0,scrollLeft:0},readyState:"complete",title:"Test Page",referrer:"",cookie:""}},logger:xt},At=function(e,t){return _async_to_generator(function(){var n,r,o,a,i,c,s,u,l,f,d;return _ts_generator(this,function(_){switch(_.label){case 0:return n=t.elb,r=t.command,o=t.window,a=t.document,i=(null==e?void 0:e.settings)||{},c=o||(void 0!==globalThis.window?globalThis.window:void 0),s=a||(void 0!==globalThis.document?globalThis.document:void 0),u=function(){return _object_spread({prefix:"data-elb",pageview:!0,session:!0,elb:"elb",elbLayer:"elbLayer",scope:(arguments.length>1?arguments[1]:void 0)||void 0},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})}(i,s),l={settings:u},f={elb:n,settings:u},c&&s?(!1!==u.elbLayer&&n&&function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.name||"elbLayer",r=t.window||window;if(r){var o=r;o[n]||(o[n]=[]);var a=o[n];a.push=function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];if(ke(r[0])){var a=_to_consumable_array(Array.from(r[0])),i=Array.prototype.push.apply(this,[a]);return je(e,t.prefix,a),i}var c=Array.prototype.push.apply(this,r);return r.forEach(function(n){je(e,t.prefix,n)}),c},Array.isArray(a)&&a.length>0&&function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"data-elb",n=arguments.length>2?arguments[2]:void 0;we(e,t,n,!0),we(e,t,n,!1),n.length=0}(e,t.prefix,a)}}(n,{name:F(u.elbLayer)?u.elbLayer:"elbLayer",prefix:u.prefix,window:c}),u.session&&n&&(d="boolean"==typeof u.session?{}:u.session,Oe(n,d,r)),[4,function(e,t,n){return _async_to_generator(function(){var r;return _ts_generator(this,function(o){return r=function(){e(t,n)},"loading"!==document.readyState?r():document.addEventListener("DOMContentLoaded",r),[2]})})()}(ve,f,u)]):[3,2];case 1:_.sent(),function(){if(pe(f,u),u.pageview){var e=_sliced_to_array(ee(u.prefix||"data-elb",u.scope),2),t=e[0],n=e[1];_e(f,"page view",t,"load",n)}}(),F(u.elb)&&u.elb&&(c[u.elb]=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=_sliced_to_array(t,6),o=r[0],a=r[1],i=r[2],c=r[3],s=r[4],u=r[5];return _e(f,o,a,i,c,s,u)}),_.label=2;case 2:return[2,{type:"browser",config:l,push:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=_sliced_to_array(t,6),o=r[0],a=r[1],i=r[2],c=r[3],s=r[4],u=r[5];return _e(f,o,a,i,c,s,u)},destroy:function(){return _async_to_generator(function(){return _ts_generator(this,function(e){return s&&de(u.scope||s),[2]})})()},on:function(e,t){return _async_to_generator(function(){var o,a,i,l;return _ts_generator(this,function(d){switch(e){case"consent":u.session&&t&&n&&(o="boolean"==typeof u.session?{}:u.session,Oe(n,o,r));break;case"session":case"ready":default:break;case"run":s&&c&&(pe(f,u),u.pageview)&&(a=_sliced_to_array(ee(u.prefix||"data-elb",u.scope),2),i=a[0],l=a[1],_e(f,"page view",i,"load",l))}return[2]})})()}}]}})})()},Pt=Object.defineProperty,Lt=function(e,t){for(var n in t)Pt(e,n,{get:t[n],enumerable:!0})},Rt=!1;Lt({},{push:function(){return Dt}});var qt=function(){},It=function(){return function(){return Promise.resolve({ok:!0,successful:[],queued:[],failed:[]})}},Ut={error:qt,info:qt,debug:qt,throw:function(e){throw"string"==typeof e?new Error(e):e},scope:function(){return Ut}},Dt={get push(){return It()},get command(){return It()},get elb(){return It()},get window(){return{dataLayer:[],addEventListener:qt,removeEventListener:qt}},logger:Ut};Lt({},{add_to_cart:function(){return Pe},config:function(){return Re},consentDefault:function(){return Ce},consentUpdate:function(){return xe},directDataLayerEvent:function(){return Ie},purchase:function(){return Ae},setCustom:function(){return qe},view_item:function(){return Le}});Lt({},{add_to_cart:function(){return Xt},config:function(){return Kt},configGA4:function(){return Gt},consentOnlyMapping:function(){return Ft},consentUpdate:function(){return Tt},customEvent:function(){return Mt},purchase:function(){return Wt},view_item:function(){return Bt}});var Nt,Tt={name:"walker consent",settings:{command:{map:{functional:{value:!0},analytics:{key:"analytics_storage",fn:function(e){return"granted"===e}},marketing:{key:"ad_storage",fn:function(e){return"granted"===e}}}}}},Wt={name:"order complete",data:{map:{id:"transaction_id",total:"value",currency:"currency",nested:{loop:["items",{map:{type:{value:"product"},data:{map:{id:"item_id",name:"item_name",category:"item_category",quantity:"quantity",price:"price"}}}}]}}}},Xt={name:"product add",data:{map:{id:"items.0.item_id",name:"items.0.item_name",price:"value",currency:"currency",color:"items.0.item_variant",quantity:"items.0.quantity"}}},Bt={name:"product view",data:{map:{id:"items.0.item_id",name:"items.0.item_name",category:"items.0.item_category",price:"items.0.price",currency:"currency"}}},Gt={name:"page view",data:{map:{title:"page_title",url:"page_location"}}},Mt={data:{map:{user_id:"user_id",custom_parameter:"custom_parameter"}}},Kt={consent:{update:Tt},purchase:Wt,add_to_cart:Xt,view_item:Bt,"config G-XXXXXXXXXX":Gt,custom_event:Mt,"*":{data:{}}},Ft={consent:{update:Tt}},Ht=function(e,t){return _async_to_generator(function(){var n,r,o,a;return _ts_generator(this,function(i){return n=t.elb,r=t.window,o=_object_spread({name:"dataLayer",prefix:"dataLayer"},null==e?void 0:e.settings),a={settings:o},[2,(r&&(function(e,t){var n=t.settings,r=(null==n?void 0:n.name)||"dataLayer",o=window[r];if(Array.isArray(o)&&!Rt){Rt=!0;try{var a=!0,i=!1,c=void 0;try{for(var s,u=o[Symbol.iterator]();!(a=(s=u.next()).done);a=!0){var l=s.value;Se(e,n,l)}}catch(e){i=!0,c=e}finally{try{a||null==u.return||u.return()}finally{if(i)throw c}}}finally{Rt=!1}}}(n,a),function(e,t){var n=t.settings,r=(null==n?void 0:n.name)||"dataLayer";window[r]||(window[r]=[]);var o=window[r];if(Array.isArray(o)){var a=o.push.bind(o);o.push=function(){for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];if(Rt)return a.apply(void 0,_to_consumable_array(r));Rt=!0;try{var i=!0,c=!1,s=void 0;try{for(var u,l=r[Symbol.iterator]();!(i=(u=l.next()).done);i=!0){var f=u.value;Se(e,n,f)}}catch(e){c=!0,s=e}finally{try{i||null==l.return||l.return()}finally{if(c)throw s}}}finally{Rt=!1}return a.apply(void 0,_to_consumable_array(r))}}}(n,a)),{type:"dataLayer",config:a,push:n,destroy:function(){return _async_to_generator(function(){var e;return _ts_generator(this,function(t){return e=o.name||"dataLayer",r&&r[e]&&Array.isArray(r[e]),[2]})})()}})]})})()},Jt={},zt=De;return Nt=Be,function(e,t,n,r){if(t&&"object"===(void 0===t?"undefined":_type_of(t))||"function"==typeof t){var o=!0,a=!1,i=void 0;try{for(var c,s=function(){var o=c.value;Xe.call(e,o)||o===n||Ne(e,o,{get:function(){return t[o]},enumerable:!(r=Te(t,o))||r.enumerable})},u=We(t)[Symbol.iterator]();!(o=(c=u.next()).done);o=!0)s()}catch(e){a=!0,i=e}finally{try{o||null==u.return||u.return()}finally{if(a)throw i}}}return e}(Ne({},"__esModule",{value:!0}),Nt)}();
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty;((t,n)=>{for(var o in n)e(t,o,{get:n[o],enumerable:!0})})({},{Level:()=>n});var t,n=((t=n||{})[t.ERROR=0]="ERROR",t[t.INFO=1]="INFO",t[t.DEBUG=2]="DEBUG",t),o={Storage:{Local:"local",Session:"session",Cookie:"cookie"}},r={merge:!0,shallow:!0,extend:!0};function i(e,t={},n={}){n={...r,...n};const o=Object.entries(t).reduce((t,[o,r])=>{const i=e[o];return n.merge&&Array.isArray(i)&&Array.isArray(r)?t[o]=r.reduce((e,t)=>e.includes(t)?e:[...e,t],[...i]):(n.extend||o in e)&&(t[o]=r),t},{});return n.shallow?{...e,...o}:(Object.assign(e,o),e)}function s(e){return Array.isArray(e)}function a(e){return void 0!==e}function c(e){return"object"==typeof e&&null!==e&&!s(e)&&"[object Object]"===Object.prototype.toString.call(e)}function u(e){return"string"==typeof e}function l(e,t=new WeakMap){if("object"!=typeof e||null===e)return e;if(t.has(e))return t.get(e);const n=Object.prototype.toString.call(e);if("[object Object]"===n){const n={};t.set(e,n);for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=l(e[o],t));return n}if("[object Array]"===n){const n=[];return t.set(e,n),e.forEach(e=>{n.push(l(e,t))}),n}if("[object Date]"===n)return new Date(e.getTime());if("[object RegExp]"===n){const t=e;return new RegExp(t.source,t.flags)}return e}function d(e,t="",n){const o=t.split(".");let r=e;for(let e=0;e<o.length;e++){const t=o[e];if("*"===t&&s(r)){const t=o.slice(e+1).join("."),i=[];for(const e of r){const o=d(e,t,n);i.push(o)}return i}if(r=r instanceof Object?r[t]:void 0,!r)break}return a(r)?r:n}function f(e,t,n){if(!c(e))return e;const o=l(e),r=t.split(".");let i=o;for(let e=0;e<r.length;e++){const t=r[e];e===r.length-1?i[t]=n:(t in i&&"object"==typeof i[t]&&null!==i[t]||(i[t]={}),i=i[t])}return o}function g(e,t={},n={}){const o={...t,...n},r={};let i=void 0===e;return Object.keys(o).forEach(t=>{o[t]&&(r[t]=!0,e&&e[t]&&(i=!0))}),!!i&&r}function m(e=6){let t="";for(let n=36;t.length<e;)t+=(Math.random()*n|0).toString(n);return t}function p(e,t=1e3,n=!1){let o,r=null,i=!1;return(...s)=>new Promise(a=>{const c=n&&!i;r&&clearTimeout(r),r=setTimeout(()=>{r=null,n&&!i||(o=e(...s),a(o))},t),c&&(i=!0,o=e(...s),a(o))})}function h(e){return{message:e.message,name:e.name,stack:e.stack,cause:e.cause}}function y(e,t){let n,o={};return e instanceof Error?(n=e.message,o.error=h(e)):n=e,void 0!==t&&(t instanceof Error?o.error=h(t):"object"==typeof t&&null!==t?(o={...o,...t},"error"in o&&o.error instanceof Error&&(o.error=h(o.error))):o.value=t),{message:n,context:o}}var b=(e,t,o,r)=>{const i=`${n[e]}${r.length>0?` [${r.join(":")}]`:""}`,s=Object.keys(o).length>0;0===e?s?console.error(i,t,o):console.error(i,t):s?console.log(i,t,o):console.log(i,t)};function v(e={}){return w({level:void 0!==e.level?(t=e.level,"string"==typeof t?n[t]:t):0,handler:e.handler,scope:[]});var t}function w(e){const{level:t,handler:n,scope:o}=e,r=(e,r,i)=>{if(e<=t){const t=y(r,i);n?n(e,t.message,t.context,o,b):b(e,t.message,t.context,o)}};return{error:(e,t)=>r(0,e,t),info:(e,t)=>r(1,e,t),debug:(e,t)=>r(2,e,t),throw:(e,t)=>{const r=y(e,t);throw n?n(0,r.message,r.context,o,b):b(0,r.message,r.context,o),new Error(r.message)},scope:e=>w({level:t,handler:n,scope:[...o,e]})}}function k(e){return function(e){return"boolean"==typeof e}(e)||u(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!a(e)||s(e)&&e.every(k)||c(e)&&Object.values(e).every(k)}function E(e){return k(e)?e:void 0}function S(e,t,n){return function(...o){try{return e(...o)}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}}function j(e,t,n){return async function(...o){try{return await e(...o)}catch(e){if(!t)return;return await t(e)}finally{await(null==n?void 0:n())}}}async function O(e,t={},n={}){var o;if(!a(e))return;const r=c(e)&&e.consent||n.consent||(null==(o=n.collector)?void 0:o.consent),i=s(t)?t:[t];for(const t of i){const o=await j(_)(e,t,{...n,consent:r});if(a(o))return o}}async function _(e,t,n={}){const{collector:o,consent:r}=n;return(s(t)?t:[t]).reduce(async(t,i)=>{const c=await t;if(c)return c;const l=u(i)?{key:i}:i;if(!Object.keys(l).length)return;const{condition:f,consent:m,fn:p,key:h,loop:y,map:b,set:v,validate:w,value:k}=l;if(f&&!await j(f)(e,i,o))return;if(m&&!g(m,r))return k;let S=a(k)?k:e;if(p&&(S=await j(p)(e,i,n)),h&&(S=d(e,h,k)),y){const[t,o]=y,r="this"===t?[e]:await O(e,t,n);s(r)&&(S=(await Promise.all(r.map(e=>O(e,o,n)))).filter(a))}else b?S=await Object.entries(b).reduce(async(t,[o,r])=>{const i=await t,s=await O(e,r,n);return a(s)&&(i[o]=s),i},Promise.resolve({})):v&&(S=await Promise.all(v.map(t=>_(e,t,n))));w&&!await j(w)(S)&&(S=void 0);const x=E(S);return a(x)?x:E(k)},Promise.resolve(void 0))}async function x(e,t,n){t.policy&&await Promise.all(Object.entries(t.policy).map(async([t,o])=>{const r=await O(e,o,{collector:n});e=f(e,t,r)}));const{eventMapping:o,mappingKey:r}=await async function(e,t){var n;const[o,r]=(e.name||"").split(" ");if(!t||!o||!r)return{};let i,a="",c=o,u=r;const l=t=>{if(t)return(t=s(t)?t:[t]).find(t=>!t.condition||t.condition(e))};t[c]||(c="*");const d=t[c];return d&&(d[u]||(u="*"),i=l(d[u])),i||(c="*",u="*",i=l(null==(n=t[c])?void 0:n[u])),i&&(a=`${c} ${u}`),{eventMapping:i,mappingKey:a}}(e,t.mapping);(null==o?void 0:o.policy)&&await Promise.all(Object.entries(o.policy).map(async([t,o])=>{const r=await O(e,o,{collector:n});e=f(e,t,r)}));let a=t.data&&await O(e,t.data,{collector:n});if(o){if(o.ignore)return{event:e,data:a,mapping:o,mappingKey:r,ignore:!0};if(o.name&&(e.name=o.name),o.data){const t=o.data&&await O(e,o.data,{collector:n});a=c(a)&&c(t)?i(a,t):t}}return{event:e,data:a,mapping:o,mappingKey:r,ignore:!1}}function L(e,t,n){return function(...o){let r;const i="post"+t,s=n["pre"+t],a=n[i];return r=s?s({fn:e},...o):e(...o),a&&(r=a({fn:e,result:r},...o)),r}}var A={Action:"action",Actions:"actions",Config:"config",Consent:"consent",Context:"context",Custom:"custom",Destination:"destination",Elb:"elb",Globals:"globals",Hook:"hook",Init:"init",Link:"link",On:"on",Prefix:"data-elb",Ready:"ready",Run:"run",Session:"session",User:"user",Walker:"walker"},C={type:"code",config:{},init(e){const{config:t,logger:n}=e,o=t.settings,r=null==o?void 0:o.scripts;if(r&&"undefined"!=typeof document)for(const e of r){const t=document.createElement("script");t.src=e,t.async=!0,document.head.appendChild(t)}const i=null==o?void 0:o.init;if(i)try{new Function("context",i)(e)}catch(e){n.error("Code destination init error:",e)}},push(e,t){var n,o;const{mapping:r,config:i,logger:s}=t,a=null!=(o=null==r?void 0:r.push)?o:null==(n=i.settings)?void 0:n.push;if(a)try{new Function("event","context",a)(e,t)}catch(e){s.error("Code destination push error:",e)}},pushBatch(e,t){var n,o;const{mapping:r,config:i,logger:s}=t,a=null!=(o=null==r?void 0:r.pushBatch)?o:null==(n=i.settings)?void 0:n.pushBatch;if(a)try{new Function("batch","context",a)(e,t)}catch(e){s.error("Code destination pushBatch error:",e)}},on(e,t){var n;const{config:o,logger:r}=t,i=null==(n=o.settings)?void 0:n.on;if(i)try{new Function("type","context",i)(e,t)}catch(e){r.error("Code destination on error:",e)}}};function $(e){return!0===e?C:e}async function q(e,t,n){const{allowed:o,consent:r,globals:s,user:a}=e;if(!o)return D({ok:!1});t&&e.queue.push(t),n||(n=e.destinations);const c=await Promise.all(Object.entries(n||{}).map(async([n,o])=>{let c=(o.queue||[]).map(e=>({...e,consent:r}));if(o.queue=[],t){const e=l(t);c.push(e)}if(!c.length)return{id:n,destination:o,skipped:!0};const u=[],d=c.filter(e=>{const t=g(o.config.consent,r,e.consent);return!t||(e.consent=t,u.push(e),!1)});if(o.queue.concat(d),!u.length)return{id:n,destination:o,queue:c};if(!await j(P)(e,o))return{id:n,destination:o,queue:c};let f=!1;return o.dlq||(o.dlq=[]),await Promise.all(u.map(async t=>(t.globals=i(s,t.globals),t.user=i(a,t.user),await j(R,n=>{const r=o.type||"unknown";return e.logger.scope(r).error("Push failed",{error:n,event:t.name}),f=!0,o.dlq.push([t,n]),!1})(e,o,t),t))),{id:n,destination:o,error:f}})),u=[],d=[],f=[];for(const e of c){if(e.skipped)continue;const t=e.destination,n={id:e.id,destination:t};e.error?f.push(n):e.queue&&e.queue.length?(t.queue=(t.queue||[]).concat(e.queue),d.push(n)):u.push(n)}return D({ok:!f.length,event:t,successful:u,queued:d,failed:f})}async function P(e,t){if(t.init&&!t.config.init){const n=t.type||"unknown",o=e.logger.scope(n),r={collector:e,config:t.config,env:I(t.env,t.config.env),logger:o};o.debug("init");const i=await L(t.init,"DestinationInit",e.hooks)(r);if(!1===i)return i;t.config={...i||t.config,init:!0},o.debug("init done")}return!0}async function R(e,t,n){const{config:o}=t,r=await x(n,o,e);if(r.ignore)return!1;const i=t.type||"unknown",s=e.logger.scope(i),c={collector:e,config:o,data:r.data,mapping:r.mapping,env:I(t.env,o.env),logger:s},u=r.mapping,l=r.mappingKey||"* *";if((null==u?void 0:u.batch)&&t.pushBatch){if(t.batches=t.batches||{},!t.batches[l]){const n={key:l,events:[],data:[]};t.batches[l]={batched:n,batchFn:p(()=>{const n=t.batches[l].batched,r={collector:e,config:o,data:void 0,mapping:u,env:I(t.env,o.env),logger:s};s.debug("push batch",{events:n.events.length}),L(t.pushBatch,"DestinationPushBatch",e.hooks)(n,r),s.debug("push batch done"),n.events=[],n.data=[]},u.batch)}}const n=t.batches[l];n.batched.events.push(r.event),a(r.data)&&n.batched.data.push(r.data),n.batchFn()}else s.debug("push",{event:r.event.name}),await L(t.push,"DestinationPush",e.hooks)(r.event,c),s.debug("push done");return!0}function D(e){var t;return i({ok:!(null==(t=null==e?void 0:e.failed)?void 0:t.length),successful:[],queued:[],failed:[]},e)}function I(e,t){return e||t?t?e&&c(e)&&c(t)?{...e,...t}:t:e:{}}function N(e,t,n,o){let r,i=n||[];switch(n||(i=e.on[t]||[]),t){case A.Consent:r=o||e.consent;break;case A.Session:r=e.session;break;case A.Ready:case A.Run:default:r=void 0}if(Object.values(e.sources).forEach(e=>{e.on&&S(e.on)(t,r)}),Object.values(e.destinations).forEach(n=>{if(n.on){const o=n.type||"unknown",i=e.logger.scope(o).scope("on").scope(t),s={collector:e,config:n.config,data:r,env:I(n.env,n.config.env),logger:i};S(n.on)(t,s)}}),i.length)switch(t){case A.Consent:!function(e,t,n){const o=n||e.consent;t.forEach(t=>{Object.keys(o).filter(e=>e in t).forEach(n=>{S(t[n])(e,o)})})}(e,i,o);break;case A.Ready:case A.Run:a=i,(s=e).allowed&&a.forEach(e=>{S(e)(s)});break;case A.Session:!function(e,t){e.session&&t.forEach(t=>{S(t)(e,e.session)})}(e,i)}var s,a}async function X(e,t,n,o){let r;switch(t){case A.Config:c(n)&&i(e.config,n,{shallow:!1});break;case A.Consent:c(n)&&(r=await async function(e,t){const{consent:n}=e;let o=!1;const r={};return Object.entries(t).forEach(([e,t])=>{const n=!!t;r[e]=n,o=o||n}),e.consent=i(n,r),N(e,"consent",void 0,r),o?q(e):D({ok:!0})}(e,n));break;case A.Custom:c(n)&&(e.custom=i(e.custom,n));break;case A.Destination:c(n)&&function(e){return"function"==typeof e}(n.push)&&(r=await async function(e,t,n){const{code:o,config:r={},env:i={}}=t,s=n||r||{init:!1},a=$(o),c={...a,config:s,env:I(a.env,i)};let u=c.config.id;if(!u)do{u=m(4)}while(e.destinations[u]);return e.destinations[u]=c,!1!==c.config.queue&&(c.queue=[...e.queue]),q(e,void 0,{[u]:c})}(e,{code:n},o));break;case A.Globals:c(n)&&(e.globals=i(e.globals,n));break;case A.On:u(n)&&function(e,t,n){const o=e.on,r=o[t]||[],i=s(n)?n:[n];i.forEach(e=>{r.push(e)}),o[t]=r,N(e,t,i)}(e,n,o);break;case A.Ready:N(e,"ready");break;case A.Run:r=await async function(e,t){e.allowed=!0,e.count=0,e.group=m(),e.timing=Date.now(),t&&(t.consent&&(e.consent=i(e.consent,t.consent)),t.user&&(e.user=i(e.user,t.user)),t.globals&&(e.globals=i(e.config.globalsStatic||{},t.globals)),t.custom&&(e.custom=i(e.custom,t.custom))),Object.values(e.destinations).forEach(e=>{e.queue=[]}),e.queue=[],e.round++;const n=await q(e);return N(e,"run"),n}(e,n);break;case A.Session:N(e,"session");break;case A.User:c(n)&&i(e.user,n,{shallow:!1})}return r||{ok:!0,successful:[],queued:[],failed:[]}}function W(e,t){return L(async(n,o={})=>await j(async()=>{let r=n;if(o.mapping){const t=await x(r,o.mapping,e);if(t.ignore)return D({ok:!0});if(o.mapping.consent&&!g(o.mapping.consent,e.consent,t.event.consent))return D({ok:!0});r=t.event}const i=t(r),s=function(e,t){if(!t.name)throw new Error("Event name is required");const[n,o]=t.name.split(" ");if(!n||!o)throw new Error("Event name is invalid");++e.count;const{timestamp:r=Date.now(),group:i=e.group,count:s=e.count}=t,{name:a=`${n} ${o}`,data:c={},context:u={},globals:l=e.globals,custom:d={},user:f=e.user,nested:g=[],consent:m=e.consent,id:p=`${r}-${i}-${s}`,trigger:h="",entity:y=n,action:b=o,timing:v=0,version:w={source:e.version,tagging:e.config.tagging||0},source:k={type:"collector",id:"",previous_id:""}}=t;return{name:a,data:c,context:u,globals:l,custom:d,user:f,nested:g,consent:m,id:p,trigger:h,entity:y,action:b,timestamp:r,timing:v,group:i,count:s,version:w,source:k}}(e,i);return await q(e,s)},()=>D({ok:!1}))(),"Push",e.hooks)}async function T(e){var t,n;const o=i({globalsStatic:{},sessionStatic:{},tagging:0,run:!0},e,{merge:!1,extend:!1}),r=v({level:null==(t=e.logger)?void 0:t.level,handler:null==(n=e.logger)?void 0:n.handler}),s={...o.globalsStatic,...e.globals},a={allowed:!1,config:o,consent:e.consent||{},count:0,custom:e.custom||{},destinations:{},globals:s,group:"",hooks:{},logger:r,on:{},queue:[],round:0,session:void 0,timing:Date.now(),user:e.user||{},version:"0.5.0",sources:{},push:void 0,command:void 0};return a.push=W(a,e=>({timing:Math.round((Date.now()-a.timing)/10)/100,source:{type:"collector",id:"",previous_id:""},...e})),a.command=(u=X,L(async(e,t,n)=>await j(async()=>await u(c,e,t,n),()=>D({ok:!1}))(),"Command",(c=a).hooks)),a.destinations=await async function(e,t={}){const n={};for(const[e,o]of Object.entries(t)){const{code:t,config:r={},env:i={}}=o,s=$(t),a={...s.config,...r},c=I(s.env,i);n[e]={...s,config:a,env:c}}return n}(0,e.destinations||{}),a;var c,u}async function U(e){e=e||{};const t=await T(e),n=(o=t,{type:"elb",config:{},push:async(e,t,n,r,i,s)=>{if("string"==typeof e&&e.startsWith("walker ")){const r=e.replace("walker ","");return o.command(r,t,n)}let a;if("string"==typeof e)a={name:e},t&&"object"==typeof t&&!Array.isArray(t)&&(a.data=t);else{if(!e||"object"!=typeof e)return{ok:!1,successful:[],queued:[],failed:[]};a=e,t&&"object"==typeof t&&!Array.isArray(t)&&(a.data={...a.data||{},...t})}return r&&"object"==typeof r&&(a.context=r),i&&Array.isArray(i)&&(a.nested=i),s&&"object"==typeof s&&(a.custom=s),o.push(a)}});var o;t.sources.elb=n;const r=await async function(e,t={}){const n={};for(const[o,r]of Object.entries(t)){const{code:t,config:i={},env:s={},primary:a}=r,c=(t,n={})=>e.push(t,{...n,mapping:i}),u=e.logger.scope("source").scope(o),l={push:c,command:e.command,sources:e.sources,elb:e.sources.elb.push,logger:u,...s},d=await j(t)(i,l);if(!d)continue;const f=d.type||"unknown",g=e.logger.scope(f).scope(o);l.logger=g,a&&(d.config={...d.config,primary:a}),n[o]=d}return n}(t,e.sources||{});Object.assign(t.sources,r);const{consent:i,user:s,globals:a,custom:c}=e;i&&await t.command("consent",i),s&&await t.command("user",s),a&&Object.assign(t.globals,a),c&&Object.assign(t.custom,c),t.config.run&&await t.command("run");let u=n.push;const l=Object.values(t.sources).filter(e=>"elb"!==e.type),d=l.find(e=>e.config.primary);return d?u=d.push:l.length>0&&(u=l[0].push),{collector:t,elb:u}}function B(e,t){return(e.getAttribute(t)||"").trim()}var M=function(){const e=window;(e.elbLayer=e.elbLayer||[]).push(arguments)};function F(e){const t=getComputedStyle(e);if("none"===t.display)return!1;if("visible"!==t.visibility)return!1;if(t.opacity&&Number(t.opacity)<.1)return!1;let n;const o=window.innerHeight,r=e.getBoundingClientRect(),i=r.height,s=r.y,a=s+i,c={x:r.x+e.offsetWidth/2,y:r.y+e.offsetHeight/2};if(i<=o){if(e.offsetWidth+r.width===0||e.offsetHeight+r.height===0)return!1;if(c.x<0)return!1;if(c.x>(document.documentElement.clientWidth||window.innerWidth))return!1;if(c.y<0)return!1;if(c.y>(document.documentElement.clientHeight||window.innerHeight))return!1;n=document.elementFromPoint(c.x,c.y)}else{const e=o/2;if(s<0&&a<e)return!1;if(a>o&&s>e)return!1;n=document.elementFromPoint(c.x,o/2)}if(n)do{if(n===e)return!0}while(n=n.parentElement);return!1}function G(e,t,n){return!1===n?e:(n||(n=H),n(e,t,H))}var H=(e,t)=>{const n={};return e.id&&(n.session=e.id),e.storage&&e.device&&(n.device=e.device),t?t.command("user",n):M("walker user",n),e.isStart&&(t?t.push({name:"session start",data:e}):M({name:"session start",data:e})),e};function K(e,t=o.Storage.Session){var n;function r(e){try{return JSON.parse(e||"")}catch(t){let n=1,o="";return e&&(n=0,o=e),{e:n,v:o}}}let i,s;switch(t){case o.Storage.Cookie:i=decodeURIComponent((null==(n=document.cookie.split("; ").find(t=>t.startsWith(e+"=")))?void 0:n.split("=")[1])||"");break;case o.Storage.Local:s=r(window.localStorage.getItem(e));break;case o.Storage.Session:s=r(window.sessionStorage.getItem(e))}return s&&(i=s.v,0!=s.e&&s.e<Date.now()&&(function(e,t=o.Storage.Session){switch(t){case o.Storage.Cookie:J(e,"",0,t);break;case o.Storage.Local:window.localStorage.removeItem(e);break;case o.Storage.Session:window.sessionStorage.removeItem(e)}}(e,t),i="")),function(e){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}(i||"")}function J(e,t,n=30,r=o.Storage.Session,i){const s={e:Date.now()+6e4*n,v:String(t)},a=JSON.stringify(s);switch(r){case o.Storage.Cookie:{t="object"==typeof t?JSON.stringify(t):t;let o=`${e}=${encodeURIComponent(t)}; max-age=${60*n}; path=/; SameSite=Lax; secure`;i&&(o+="; domain="+i),document.cookie=o;break}case o.Storage.Local:window.localStorage.setItem(e,a);break;case o.Storage.Session:window.sessionStorage.setItem(e,a)}return K(e,r)}function z(e={}){const t=Date.now(),{length:n=30,deviceKey:o="elbDeviceId",deviceStorage:r="local",deviceAge:i=30,sessionKey:s="elbSessionId",sessionStorage:a="local",pulse:c=!1}=e,u=Y(e);let l=!1;const d=S((e,t,n)=>{let o=K(e,n);return o||(o=m(8),J(e,o,1440*t,n)),String(o)})(o,i,r),f=S((e,o)=>{const r=JSON.parse(String(K(e,o)));return c||(r.isNew=!1,u.marketing&&(Object.assign(r,u),l=!0),l||r.updated+6e4*n<t?(delete r.id,delete r.referrer,r.start=t,r.count++,r.runs=1,l=!0):r.runs++),r},()=>{l=!0})(s,a)||{},g={id:m(12),start:t,isNew:!0,count:1,runs:1},p=Object.assign(g,u,f,{device:d},{isStart:l,storage:!0,updated:t},e.data);return J(s,JSON.stringify(p),2*n,a),p}function Y(e={}){let t=e.isStart||!1;const n={isStart:t,storage:!1};if(!1===e.isStart)return n;if(!t){const[e]=performance.getEntriesByType("navigation");if("navigate"!==e.type)return n}const o=new URL(e.url||window.location.href),r=e.referrer||document.referrer,s=r&&new URL(r).hostname,a=function(e,t={}){const n="clickId",o={},r={utm_campaign:"campaign",utm_content:"content",utm_medium:"medium",utm_source:"source",utm_term:"term",dclid:n,fbclid:n,gclid:n,msclkid:n,ttclid:n,twclid:n,igshid:n,sclid:n};return Object.entries(i(r,t)).forEach(([t,r])=>{const i=e.searchParams.get(t);i&&(r===n&&(r=t,o[n]=t),o[r]=i)}),o}(o,e.parameters);if(Object.keys(a).length&&(a.marketing||(a.marketing=!0),t=!0),!t){const n=e.domains||[];n.push(o.hostname),t=!n.includes(s)}return t?Object.assign({isStart:t,storage:!1,start:Date.now(),id:m(12),referrer:s},a,e.data):n}var V,Q=Object.defineProperty,Z=(e,t)=>{for(var n in t)Q(e,n,{get:t[n],enumerable:!0})},ee=Object.defineProperty;((e,t)=>{for(var n in t)ee(e,n,{get:t[n],enumerable:!0})})({},{Level:()=>te});var te=((V=te||{})[V.ERROR=0]="ERROR",V[V.INFO=1]="INFO",V[V.DEBUG=2]="DEBUG",V),ne={merge:!0,shallow:!0,extend:!0};function oe(e,t={},n={}){n={...ne,...n};const o=Object.entries(t).reduce((t,[o,r])=>{const i=e[o];return n.merge&&Array.isArray(i)&&Array.isArray(r)?t[o]=r.reduce((e,t)=>e.includes(t)?e:[...e,t],[...i]):(n.extend||o in e)&&(t[o]=r),t},{});return n.shallow?{...e,...o}:(Object.assign(e,o),e)}function re(e){return Array.isArray(e)}function ie(e){return e===document||e instanceof Element}function se(e){return"object"==typeof e&&null!==e&&!re(e)&&"[object Object]"===Object.prototype.toString.call(e)}function ae(e){return"string"==typeof e}function ce(e){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}function ue(e,t,n){return function(...o){try{return e(...o)}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}}function le(e){return e?e.trim().replace(/^'|'$/g,"").trim():""}function de(e,t,n=!0){return e+(null!=t?(n?"-":"")+t:"")}function fe(e,t,n,o=!0){return Se(B(t,de(e,n,o))||"").reduce((e,n)=>{let[o,r]=je(n);if(!o)return e;if(r||(o.endsWith(":")&&(o=o.slice(0,-1)),r=""),r.startsWith("#")){r=r.slice(1);try{let e=t[r];e||"selected"!==r||(e=t.options[t.selectedIndex].text),r=String(e)}catch(e){r=""}}return o.endsWith("[]")?(o=o.slice(0,-2),re(e[o])||(e[o]=[]),e[o].push(ce(r))):e[o]=ce(r),e},{})}function ge(e,t=A.Prefix){var n;const o=e||document.body;if(!o)return[];let r=[];const i=A.Action,s=`[${de(t,i,!1)}]`,a=e=>{Object.keys(fe(t,e,i,!1)).forEach(n=>{r=r.concat(me(e,n,t))})};return o!==document&&(null==(n=o.matches)?void 0:n.call(o,s))&&a(o),Ee(o,s,a),r}function me(e,t,n=A.Prefix){const o=[],{actions:r,nearestOnly:i}=function(e,t,n){let o=t;for(;o;){const t=B(o,de(e,A.Actions,!1));if(t){const e=ye(t);if(e[n])return{actions:e[n],nearestOnly:!1}}const r=B(o,de(e,A.Action,!1));if(r){const e=ye(r);if(e[n]||"click"!==n)return{actions:e[n]||[],nearestOnly:!0}}o=we(e,o)}return{actions:[],nearestOnly:!1}}(n,e,t);return r.length?(r.forEach(r=>{const s=Se(r.actionParams||"",",").reduce((e,t)=>(e[le(t)]=!0,e),{}),a=be(n,e,s,i);if(!a.length){const t="page",o=`[${de(n,t)}]`,[r,i]=ke(e,o,n,t);a.push({entity:t,data:r,nested:[],context:i})}a.forEach(e=>{o.push({entity:e.entity,action:r.action,data:e.data,trigger:t,context:e.context,nested:e.nested})})}),o):o}function pe(e=A.Prefix,t=document){const n=de(e,A.Globals,!1);let o={};return Ee(t,`[${n}]`,t=>{o=oe(o,fe(e,t,A.Globals,!1))}),o}function he(e,t){const n=window.location,o="page",r=t===document?document.body:t,[i,s]=ke(r,`[${de(e,o)}]`,e,o);return i.domain=n.hostname,i.title=document.title,i.referrer=document.referrer,n.search&&(i.search=n.search),n.hash&&(i.hash=n.hash),[i,s]}function ye(e){const t={};return Se(e).forEach(e=>{const[n,o]=je(e),[r,i]=Oe(n);if(!r)return;let[s,a]=Oe(o||"");s=s||r,t[r]||(t[r]=[]),t[r].push({trigger:r,triggerParams:i,action:s,actionParams:a})}),t}function be(e,t,n,o=!1){const r=[];let i=t;for(n=0!==Object.keys(n||{}).length?n:void 0;i;){const s=ve(e,i,t,n);if(s&&(r.push(s),o))break;i=we(e,i)}return r}function ve(e,t,n,o){const r=B(t,de(e));if(!r||o&&!o[r])return null;const i=[t],s=`[${de(e,r)}],[${de(e,"")}]`,a=de(e,A.Link,!1);let c={};const u=[],[l,d]=ke(n||t,s,e,r);Ee(t,`[${a}]`,t=>{const[n,o]=je(B(t,a));"parent"===o&&Ee(document.body,`[${a}="${n}:child"]`,t=>{i.push(t);const n=ve(e,t);n&&u.push(n)})});const f=[];i.forEach(e=>{e.matches(s)&&f.push(e),Ee(e,s,e=>f.push(e))});let g={};return f.forEach(t=>{g=oe(g,fe(e,t,"")),c=oe(c,fe(e,t,r))}),c=oe(oe(g,c),l),i.forEach(t=>{Ee(t,`[${de(e)}]`,t=>{const n=ve(e,t);n&&u.push(n)})}),{entity:r,data:c,context:d,nested:u}}function we(e,t){const n=de(e,A.Link,!1);if(t.matches(`[${n}]`)){const[e,o]=je(B(t,n));if("child"===o)return document.querySelector(`[${n}="${e}:parent"]`)}return!t.parentElement&&t.getRootNode&&t.getRootNode()instanceof ShadowRoot?t.getRootNode().host:t.parentElement}function ke(e,t,n,o){let r={};const i={};let s=e;const a=`[${de(n,A.Context,!1)}]`;let c=0;for(;s;)s.matches(t)&&(r=oe(fe(n,s,""),r),r=oe(fe(n,s,o),r)),s.matches(a)&&(Object.entries(fe(n,s,A.Context,!1)).forEach(([e,t])=>{t&&!i[e]&&(i[e]=[t,c])}),++c),s=we(n,s);return[r,i]}function Ee(e,t,n){e.querySelectorAll(t).forEach(n)}function Se(e,t=";"){if(!e)return[];const n=new RegExp(`(?:[^${t}']+|'[^']*')+`,"ig");return e.match(n)||[]}function je(e){const[t,n]=e.split(/:(.+)/,2);return[le(t),le(n)]}function Oe(e){const[t,n]=e.split("(",2);return[t,n?n.slice(0,-1):""]}var _e,xe=new WeakMap,Le=new WeakMap,Ae=new WeakMap;function Ce(e){const t=Date.now();let n=Le.get(e);return(!n||t-n.lastChecked>500)&&(n={isVisible:F(e),lastChecked:t},Le.set(e,n)),n.isVisible}function $e(e){if(window.IntersectionObserver)return ue(()=>new window.IntersectionObserver(t=>{t.forEach(t=>{!function(e,t){var n,o;const r=t.target,i=Ae.get(e);if(!i)return;const s=i.timers.get(r);if(t.intersectionRatio>0){const o=Date.now();let a=xe.get(r);if((!a||o-a.lastChecked>1e3)&&(a={isLarge:r.offsetHeight>window.innerHeight,lastChecked:o},xe.set(r,a)),t.intersectionRatio>=.5||a.isLarge&&Ce(r)){const t=null==(n=i.elementConfigs)?void 0:n.get(r);if((null==t?void 0:t.multiple)&&t.blocked)return;if(!s){const t=window.setTimeout(async()=>{var t,n;if(Ce(r)){const o=null==(t=i.elementConfigs)?void 0:t.get(r);(null==o?void 0:o.context)&&await Fe(o.context,r,o.trigger);const s=null==(n=i.elementConfigs)?void 0:n.get(r);(null==s?void 0:s.multiple)?s.blocked=!0:function(e,t){const n=Ae.get(e);if(!n)return;n.observer&&n.observer.unobserve(t);const o=n.timers.get(t);o&&(clearTimeout(o),n.timers.delete(t)),xe.delete(t),Le.delete(t)}(e,r)}},i.duration);i.timers.set(r,t)}return}}s&&(clearTimeout(s),i.timers.delete(r));const a=null==(o=i.elementConfigs)?void 0:o.get(r);(null==a?void 0:a.multiple)&&(a.blocked=!1)}(e,t)})},{rootMargin:"0px",threshold:[0,.5]}),()=>{})()}function qe(e,t,n={multiple:!1}){var o;const r=e.settings.scope||document,i=Ae.get(r);(null==i?void 0:i.observer)&&t&&(i.elementConfigs||(i.elementConfigs=new WeakMap),i.elementConfigs.set(t,{multiple:null!=(o=n.multiple)&&o,blocked:!1,context:e,trigger:n.multiple?"visible":"impression"}),i.observer.observe(t))}function Pe(e){if(!e)return;const t=Ae.get(e);t&&(t.observer&&t.observer.disconnect(),Ae.delete(e))}function Re(e,t,n,o,r,i,s){const{elb:a,settings:c}=e;if(ae(t)&&t.startsWith("walker "))return a(t,n);if(se(t)){const e=t;return e.source||(e.source=De()),e.globals||(e.globals=pe(c.prefix,c.scope||document)),a(e)}const[u]=String(se(t)?t.name:t).split(" ");let l,d=se(n)?n:{},f={},g=!1;if(ie(n)&&(l=n,g=!0),ie(r)?l=r:se(r)&&Object.keys(r).length&&(f=r),l){const e=be(c.prefix||"data-elb",l).find(e=>e.entity===u);e&&(g&&(d=e.data),f=e.context)}"page"===u&&(d.id=d.id||window.location.pathname);const m=pe(c.prefix,c.scope);return a({name:String(t||""),data:d,context:f,globals:m,nested:i,custom:s,trigger:ae(o)?o:"",source:De()})}function De(){return{type:"browser",id:window.location.href,previous_id:document.referrer}}var Ie=[],Ne="hover",Xe="load",We="pulse",Te="scroll",Ue="wait";function Be(e,t){t.scope&&function(e,t){const n=t.scope;n&&(n.addEventListener("click",ue(function(t){He.call(this,e,t)})),n.addEventListener("submit",ue(function(t){Ke.call(this,e,t)})))}(e,t)}function Me(e,t){t.scope&&function(e,t){const n=t.scope;Ie=[];const o=n||document;Pe(o),function(e,t=1e3){Ae.has(e)||Ae.set(e,{observer:$e(e),timers:new WeakMap,duration:t})}(o,1e3);const r=de(t.prefix,A.Action,!1);o!==document&&Ge(e,o,r,t),o.querySelectorAll(`[${r}]`).forEach(n=>{Ge(e,n,r,t)}),Ie.length&&function(e,t){const n=(e,t)=>e.filter(([e,n])=>{const o=window.scrollY+window.innerHeight,r=e.offsetTop;if(o<r)return!0;const i=e.clientHeight;return!(100*(1-(r+i-o)/(i||1))>=n&&(Fe(t,e,Te),1))});_e||(_e=function(e,t=1e3){let n=null;return function(...o){if(null===n)return n=setTimeout(()=>{n=null},t),e(...o)}}(function(){Ie=n.call(t,Ie,e)}),t.addEventListener("scroll",_e))}(e,o)}(e,t)}async function Fe(e,t,n){const o=me(t,n,e.settings.prefix);return Promise.all(o.map(t=>Re(e,{name:`${t.entity} ${t.action}`,...t,trigger:n})))}function Ge(e,t,n,o){const r=B(t,n);r&&Object.values(ye(r)).forEach(n=>n.forEach(n=>{switch(n.trigger){case Ne:o=e,t.addEventListener("mouseenter",ue(function(e){e.target instanceof Element&&Fe(o,e.target,Ne)}));break;case Xe:!function(e,t){Fe(e,t,Xe)}(e,t);break;case We:!function(e,t,n=""){setInterval(()=>{document.hidden||Fe(e,t,We)},parseInt(n||"")||15e3)}(e,t,n.triggerParams);break;case Te:!function(e,t=""){const n=parseInt(t||"")||50;n<0||n>100||Ie.push([e,n])}(t,n.triggerParams);break;case"impression":qe(e,t);break;case"visible":qe(e,t,{multiple:!0});break;case Ue:!function(e,t,n=""){setTimeout(()=>Fe(e,t,Ue),parseInt(n||"")||15e3)}(e,t,n.triggerParams)}var o}))}function He(e,t){Fe(e,t.target,"click")}function Ke(e,t){t.target&&Fe(e,t.target,"submit")}function Je(e,t,n,o){const r=[];let i=!0;n.forEach(e=>{const t=Ye(e)?[...Array.from(e)]:null!=(n=e)&&"object"==typeof n&&"length"in n&&"number"==typeof n.length?Array.from(e):[e];var n;if(Array.isArray(t)&&0===t.length)return;if(Array.isArray(t)&&1===t.length&&!t[0])return;const s=t[0],a=!se(s)&&ae(s)&&s.startsWith("walker ");if(se(s)){if("object"==typeof s&&0===Object.keys(s).length)return}else{const e=Array.from(t);if(!ae(e[0])||""===e[0].trim())return;const n="walker run";i&&e[0]===n&&(i=!1)}(o&&a||!o&&!a)&&r.push(t)}),r.forEach(n=>{ze(e,t,n)})}function ze(e,t="data-elb",n){ue(()=>{if(Array.isArray(n)){const[o,...r]=n;if(!o||ae(o)&&""===o.trim())return;if(ae(o)&&o.startsWith("walker "))return void e(o,r[0]);Re({elb:e,settings:{prefix:t,scope:document,pageview:!1,session:!1,elb:"",elbLayer:!1}},o,...r)}else if(n&&"object"==typeof n){if(0===Object.keys(n).length)return;e(n)}},()=>{})()}function Ye(e){return null!=e&&"object"==typeof e&&"[object Arguments]"===Object.prototype.toString.call(e)}function Ve(e,t={},n){return function(e={}){const{cb:t,consent:n,collector:o,storage:r}=e;if(!n)return G((r?z:Y)(e),o,t);{const r=function(e,t){let n;return(o,r)=>{if(a(n)&&n===(null==o?void 0:o.group))return;n=null==o?void 0:o.group;let i=()=>Y(e);return e.consent&&g((s(e.consent)?e.consent:[e.consent]).reduce((e,t)=>({...e,[t]:!0}),{}),r)&&(i=()=>z(e)),G(i(),o,t)}}(e,t),i=(s(n)?n:[n]).reduce((e,t)=>({...e,[t]:r}),{});o?o.command("on","consent",i):M("walker on","consent",i)}}({...t,collector:{push:e,group:void 0,command:n}})}Z({},{env:()=>Qe});var Qe={};Z(Qe,{push:()=>nt});var Ze=()=>{},et=()=>()=>Promise.resolve({ok:!0,successful:[],queued:[],failed:[]}),tt={error:Ze,info:Ze,debug:Ze,throw:e=>{throw"string"==typeof e?new Error(e):e},scope:()=>tt},nt={get push(){return et()},get command(){return et()},get elb(){return et()},get window(){return{addEventListener:Ze,removeEventListener:Ze,location:{href:"https://example.com/page",pathname:"/page",search:"?query=test",hash:"#section",host:"example.com",hostname:"example.com",origin:"https://example.com",protocol:"https:"},document:{},navigator:{language:"en-US",userAgent:"Mozilla/5.0 (Test)"},screen:{width:1920,height:1080},innerWidth:1920,innerHeight:1080,pageXOffset:0,pageYOffset:0,scrollX:0,scrollY:0}},get document(){return{addEventListener:Ze,removeEventListener:Ze,querySelector:Ze,querySelectorAll:()=>[],getElementById:Ze,getElementsByClassName:()=>[],getElementsByTagName:()=>[],createElement:()=>({setAttribute:Ze,getAttribute:Ze,addEventListener:Ze,removeEventListener:Ze}),body:{appendChild:Ze,removeChild:Ze},documentElement:{scrollTop:0,scrollLeft:0},readyState:"complete",title:"Test Page",referrer:"",cookie:""}},logger:tt},ot=async(e,t)=>{const{elb:n,command:o,window:r,document:i}=t,s=(null==e?void 0:e.settings)||{},a=r||(void 0!==globalThis.window?globalThis.window:void 0),c=i||(void 0!==globalThis.document?globalThis.document:void 0),u=function(e={},t){return{prefix:"data-elb",pageview:!0,session:!0,elb:"elb",elbLayer:"elbLayer",scope:t||void 0,...e}}(s,c),l={settings:u},d={elb:n,settings:u};if(a&&c){if(!1!==u.elbLayer&&n&&function(e,t={}){const n=t.name||"elbLayer",o=t.window||window;if(!o)return;const r=o;r[n]||(r[n]=[]);const i=r[n];i.push=function(...n){if(Ye(n[0])){const o=[...Array.from(n[0])],r=Array.prototype.push.apply(this,[o]);return ze(e,t.prefix,o),r}const o=Array.prototype.push.apply(this,n);return n.forEach(n=>{ze(e,t.prefix,n)}),o},Array.isArray(i)&&i.length>0&&function(e,t="data-elb",n){Je(e,t,n,!0),Je(e,t,n,!1),n.length=0}(e,t.prefix,i)}(n,{name:ae(u.elbLayer)?u.elbLayer:"elbLayer",prefix:u.prefix,window:a}),u.session&&n){const e="boolean"==typeof u.session?{}:u.session;Ve(n,e,o)}await async function(e,t,n){const o=()=>{e(t,n)};"loading"!==document.readyState?o():document.addEventListener("DOMContentLoaded",o)}(Be,d,u),(()=>{if(Me(d,u),u.pageview){const[e,t]=he(u.prefix||"data-elb",u.scope);Re(d,"page view",e,"load",t)}})(),ae(u.elb)&&u.elb&&(a[u.elb]=(...e)=>{const[t,n,o,r,i,s]=e;return Re(d,t,n,o,r,i,s)})}return{type:"browser",config:l,push:(...e)=>{const[t,n,o,r,i,s]=e;return Re(d,t,n,o,r,i,s)},destroy:async()=>{c&&Pe(u.scope||c)},on:async(e,t)=>{switch(e){case"consent":if(u.session&&t&&n){const e="boolean"==typeof u.session?{}:u.session;Ve(n,e,o)}break;case"session":case"ready":default:break;case"run":if(c&&a&&(Me(d,u),u.pageview)){const[e,t]=he(u.prefix||"data-elb",u.scope);Re(d,"page view",e,"load",t)}}}}},rt=Object.defineProperty,it=(e,t)=>{for(var n in t)rt(e,n,{get:t[n],enumerable:!0})},st=!1;function at(e,t={},n){if(t.filter&&!0===S(()=>t.filter(n),()=>!1)())return;const o=function(e){if(c(e)&&u(e.event)){const{event:t,...n}=e;return{name:t,...n}}return s(e)&&e.length>=2?ct(e):null!=(t=e)&&"object"==typeof t&&"length"in t&&"number"==typeof t.length&&t.length>0?ct(Array.from(e)):null;var t}(n);if(!o)return;const r=`${t.prefix||"dataLayer"} ${o.name}`,{name:i,...a}=o,l={name:r,data:a};S(()=>e(l),()=>{})()}function ct(e){const[t,n,o]=e;if(!u(t))return null;let r,i={};switch(t){case"consent":if(!u(n)||e.length<3)return null;if("default"!==n&&"update"!==n)return null;if(!c(o)||null===o)return null;r=`${t} ${n}`,i={...o};break;case"event":if(!u(n))return null;r=n,c(o)&&(i={...o});break;case"config":if(!u(n))return null;r=`${t} ${n}`,c(o)&&(i={...o});break;case"set":if(u(n))r=`${t} ${n}`,c(o)&&(i={...o});else{if(!c(n))return null;r=`${t} custom`,i={...n}}break;default:return null}return{name:r,...i}}it({},{push:()=>ft});var ut=()=>{},lt=()=>()=>Promise.resolve({ok:!0,successful:[],queued:[],failed:[]}),dt={error:ut,info:ut,debug:ut,throw:e=>{throw"string"==typeof e?new Error(e):e},scope:()=>dt},ft={get push(){return lt()},get command(){return lt()},get elb(){return lt()},get window(){return{dataLayer:[],addEventListener:ut,removeEventListener:ut}},logger:dt};function gt(){return["consent","update",{ad_user_data:"granted",ad_personalization:"granted",ad_storage:"denied",analytics_storage:"granted"}]}function mt(){return["consent","default",{ad_storage:"denied",analytics_storage:"denied",ad_user_data:"denied",ad_personalization:"denied"}]}function pt(){return["event","purchase",{transaction_id:"T_12345",value:25.42,currency:"EUR",items:[{item_id:"SKU_12345",item_name:"Product Name",item_category:"Category",quantity:1,price:25.42}]}]}function ht(){return["event","add_to_cart",{currency:"EUR",value:15.25,items:[{item_id:"SKU_12345",item_name:"Product Name",item_variant:"red",quantity:1,price:15.25}]}]}function yt(){return["event","view_item",{currency:"EUR",value:15.25,items:[{item_id:"SKU_12345",item_name:"Product Name",item_category:"Category",price:15.25}]}]}function bt(){return["config","G-XXXXXXXXXX",{page_title:"Custom Page Title",page_location:"https://example.com/page",send_page_view:!1}]}function vt(){return["set",{currency:"EUR",country:"DE"}]}function wt(){return{event:"custom_event",custom_parameter:"custom_value",user_id:"user123"}}it({},{add_to_cart:()=>ht,config:()=>bt,consentDefault:()=>mt,consentUpdate:()=>gt,directDataLayerEvent:()=>wt,purchase:()=>pt,setCustom:()=>vt,view_item:()=>yt});it({},{add_to_cart:()=>St,config:()=>xt,configGA4:()=>Ot,consentOnlyMapping:()=>Lt,consentUpdate:()=>kt,customEvent:()=>_t,purchase:()=>Et,view_item:()=>jt});var kt={name:"walker consent",settings:{command:{map:{functional:{value:!0},analytics:{key:"analytics_storage",fn:e=>"granted"===e},marketing:{key:"ad_storage",fn:e=>"granted"===e}}}}},Et={name:"order complete",data:{map:{id:"transaction_id",total:"value",currency:"currency",nested:{loop:["items",{map:{type:{value:"product"},data:{map:{id:"item_id",name:"item_name",category:"item_category",quantity:"quantity",price:"price"}}}}]}}}},St={name:"product add",data:{map:{id:"items.0.item_id",name:"items.0.item_name",price:"value",currency:"currency",color:"items.0.item_variant",quantity:"items.0.quantity"}}},jt={name:"product view",data:{map:{id:"items.0.item_id",name:"items.0.item_name",category:"items.0.item_category",price:"items.0.price",currency:"currency"}}},Ot={name:"page view",data:{map:{title:"page_title",url:"page_location"}}},_t={data:{map:{user_id:"user_id",custom_parameter:"custom_parameter"}}},xt={consent:{update:kt},purchase:Et,add_to_cart:St,view_item:jt,"config G-XXXXXXXXXX":Ot,custom_event:_t,"*":{data:{}}},Lt={consent:{update:kt}},At=async(e,t)=>{const{elb:n,window:o}=t,r={name:"dataLayer",prefix:"dataLayer",...null==e?void 0:e.settings},i={settings:r};return o&&(function(e,t){const n=t.settings,o=(null==n?void 0:n.name)||"dataLayer",r=window[o];if(Array.isArray(r)&&!st){st=!0;try{for(const t of r)at(e,n,t)}finally{st=!1}}}(n,i),function(e,t){const n=t.settings,o=(null==n?void 0:n.name)||"dataLayer";window[o]||(window[o]=[]);const r=window[o];if(!Array.isArray(r))return;const i=r.push.bind(r);r.push=function(...t){if(st)return i(...t);st=!0;try{for(const o of t)at(e,n,o)}finally{st=!1}return i(...t)}}(n,i)),{type:"dataLayer",config:i,push:n,destroy:async()=>{const e=r.name||"dataLayer";o&&o[e]&&Array.isArray(o[e])}}};function Ct(){window.dataLayer=window.dataLayer||[];const e=e=>{c(e)&&c(e.source)&&String(e.source.type).includes("dataLayer")||window.dataLayer.push(e)};return{type:"dataLayer",config:{},push:(t,n)=>{e(n.data||t)},pushBatch:t=>{e({name:"batch",batched_event:t.key,events:t.data.length?t.data:t.events})}}}var $t={};async function qt(e={}){const t=i({collector:{destinations:{dataLayer:{code:Ct()}}},browser:{session:!0},dataLayer:!1,elb:"elb",run:!0},e),n={...t.collector,sources:{browser:{code:ot,config:{settings:t.browser},env:{window:"undefined"!=typeof window?window:void 0,document:"undefined"!=typeof document?document:void 0}}}};if(t.dataLayer){const e=c(t.dataLayer)?t.dataLayer:{};n.sources&&(n.sources.dataLayer={code:At,config:{settings:e}})}const o=await U(n);return"undefined"!=typeof window&&(t.elb&&(window[t.elb]=o.elb),t.name&&(window[t.name]=o.collector)),o}var Pt=qt;export{$t as Walkerjs,qt as createWalkerjs,Pt as default,ge as getAllEvents,me as getEvents,pe as getGlobals};//# sourceMappingURL=index.mjs.map
|
|
1
|
+
var e=Object.defineProperty;((t,n)=>{for(var o in n)e(t,o,{get:n[o],enumerable:!0})})({},{Level:()=>n});var t,n=((t=n||{})[t.ERROR=0]="ERROR",t[t.INFO=1]="INFO",t[t.DEBUG=2]="DEBUG",t),o={Storage:{Local:"local",Session:"session",Cookie:"cookie"}},r={merge:!0,shallow:!0,extend:!0};function i(e,t={},n={}){n={...r,...n};const o=Object.entries(t).reduce((t,[o,r])=>{const i=e[o];return n.merge&&Array.isArray(i)&&Array.isArray(r)?t[o]=r.reduce((e,t)=>e.includes(t)?e:[...e,t],[...i]):(n.extend||o in e)&&(t[o]=r),t},{});return n.shallow?{...e,...o}:(Object.assign(e,o),e)}function s(e){return Array.isArray(e)}function a(e){return void 0!==e}function c(e){return"object"==typeof e&&null!==e&&!s(e)&&"[object Object]"===Object.prototype.toString.call(e)}function u(e){return"string"==typeof e}function l(e,t=new WeakMap){if("object"!=typeof e||null===e)return e;if(t.has(e))return t.get(e);const n=Object.prototype.toString.call(e);if("[object Object]"===n){const n={};t.set(e,n);for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=l(e[o],t));return n}if("[object Array]"===n){const n=[];return t.set(e,n),e.forEach(e=>{n.push(l(e,t))}),n}if("[object Date]"===n)return new Date(e.getTime());if("[object RegExp]"===n){const t=e;return new RegExp(t.source,t.flags)}return e}function d(e,t="",n){const o=t.split(".");let r=e;for(let e=0;e<o.length;e++){const t=o[e];if("*"===t&&s(r)){const t=o.slice(e+1).join("."),i=[];for(const e of r){const o=d(e,t,n);i.push(o)}return i}if(r=r instanceof Object?r[t]:void 0,!r)break}return a(r)?r:n}function f(e,t,n){if(!c(e))return e;const o=l(e),r=t.split(".");let i=o;for(let e=0;e<r.length;e++){const t=r[e];e===r.length-1?i[t]=n:(t in i&&"object"==typeof i[t]&&null!==i[t]||(i[t]={}),i=i[t])}return o}function g(e,t={},n={}){const o={...t,...n},r={};let i=void 0===e;return Object.keys(o).forEach(t=>{o[t]&&(r[t]=!0,e&&e[t]&&(i=!0))}),!!i&&r}function m(e=6){let t="";for(let n=36;t.length<e;)t+=(Math.random()*n|0).toString(n);return t}function p(e,t=1e3,n=!1){let o,r=null,i=!1;return(...s)=>new Promise(a=>{const c=n&&!i;r&&clearTimeout(r),r=setTimeout(()=>{r=null,n&&!i||(o=e(...s),a(o))},t),c&&(i=!0,o=e(...s),a(o))})}function h(e){return{message:e.message,name:e.name,stack:e.stack,cause:e.cause}}function y(e,t){let n,o={};return e instanceof Error?(n=e.message,o.error=h(e)):n=e,void 0!==t&&(t instanceof Error?o.error=h(t):"object"==typeof t&&null!==t?(o={...o,...t},"error"in o&&o.error instanceof Error&&(o.error=h(o.error))):o.value=t),{message:n,context:o}}var b=(e,t,o,r)=>{const i=`${n[e]}${r.length>0?` [${r.join(":")}]`:""}`,s=Object.keys(o).length>0;0===e?s?console.error(i,t,o):console.error(i,t):s?console.log(i,t,o):console.log(i,t)};function v(e={}){return w({level:void 0!==e.level?(t=e.level,"string"==typeof t?n[t]:t):0,handler:e.handler,scope:[]});var t}function w(e){const{level:t,handler:n,scope:o}=e,r=(e,r,i)=>{if(e<=t){const t=y(r,i);n?n(e,t.message,t.context,o,b):b(e,t.message,t.context,o)}};return{error:(e,t)=>r(0,e,t),info:(e,t)=>r(1,e,t),debug:(e,t)=>r(2,e,t),throw:(e,t)=>{const r=y(e,t);throw n?n(0,r.message,r.context,o,b):b(0,r.message,r.context,o),new Error(r.message)},scope:e=>w({level:t,handler:n,scope:[...o,e]})}}function k(e){return function(e){return"boolean"==typeof e}(e)||u(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!a(e)||s(e)&&e.every(k)||c(e)&&Object.values(e).every(k)}function E(e){return k(e)?e:void 0}function S(e,t,n){return function(...o){try{return e(...o)}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}}function j(e,t,n){return async function(...o){try{return await e(...o)}catch(e){if(!t)return;return await t(e)}finally{await(null==n?void 0:n())}}}async function O(e,t={},n={}){var o;if(!a(e))return;const r=c(e)&&e.consent||n.consent||(null==(o=n.collector)?void 0:o.consent),i=s(t)?t:[t];for(const t of i){const o=await j(_)(e,t,{...n,consent:r});if(a(o))return o}}async function _(e,t,n={}){const{collector:o,consent:r}=n;return(s(t)?t:[t]).reduce(async(t,i)=>{const c=await t;if(c)return c;const l=u(i)?{key:i}:i;if(!Object.keys(l).length)return;const{condition:f,consent:m,fn:p,key:h,loop:y,map:b,set:v,validate:w,value:k}=l;if(f&&!await j(f)(e,i,o))return;if(m&&!g(m,r))return k;let S=a(k)?k:e;if(p&&(S=await j(p)(e,i,n)),h&&(S=d(e,h,k)),y){const[t,o]=y,r="this"===t?[e]:await O(e,t,n);s(r)&&(S=(await Promise.all(r.map(e=>O(e,o,n)))).filter(a))}else b?S=await Object.entries(b).reduce(async(t,[o,r])=>{const i=await t,s=await O(e,r,n);return a(s)&&(i[o]=s),i},Promise.resolve({})):v&&(S=await Promise.all(v.map(t=>_(e,t,n))));w&&!await j(w)(S)&&(S=void 0);const x=E(S);return a(x)?x:E(k)},Promise.resolve(void 0))}async function x(e,t,n){t.policy&&await Promise.all(Object.entries(t.policy).map(async([t,o])=>{const r=await O(e,o,{collector:n});e=f(e,t,r)}));const{eventMapping:o,mappingKey:r}=await async function(e,t){var n;const[o,r]=(e.name||"").split(" ");if(!t||!o||!r)return{};let i,a="",c=o,u=r;const l=t=>{if(t)return(t=s(t)?t:[t]).find(t=>!t.condition||t.condition(e))};t[c]||(c="*");const d=t[c];return d&&(d[u]||(u="*"),i=l(d[u])),i||(c="*",u="*",i=l(null==(n=t[c])?void 0:n[u])),i&&(a=`${c} ${u}`),{eventMapping:i,mappingKey:a}}(e,t.mapping);(null==o?void 0:o.policy)&&await Promise.all(Object.entries(o.policy).map(async([t,o])=>{const r=await O(e,o,{collector:n});e=f(e,t,r)}));let a=t.data&&await O(e,t.data,{collector:n});if(o){if(o.ignore)return{event:e,data:a,mapping:o,mappingKey:r,ignore:!0};if(o.name&&(e.name=o.name),o.data){const t=o.data&&await O(e,o.data,{collector:n});a=c(a)&&c(t)?i(a,t):t}}return{event:e,data:a,mapping:o,mappingKey:r,ignore:!1}}function L(e,t,n){return function(...o){let r;const i="post"+t,s=n["pre"+t],a=n[i];return r=s?s({fn:e},...o):e(...o),a&&(r=a({fn:e,result:r},...o)),r}}var A={Action:"action",Actions:"actions",Config:"config",Consent:"consent",Context:"context",Custom:"custom",Destination:"destination",Elb:"elb",Globals:"globals",Hook:"hook",Init:"init",Link:"link",On:"on",Prefix:"data-elb",Ready:"ready",Run:"run",Session:"session",User:"user",Walker:"walker"},C={type:"code",config:{},init(e){const{config:t,logger:n}=e,o=t.settings,r=null==o?void 0:o.scripts;if(r&&"undefined"!=typeof document)for(const e of r){const t=document.createElement("script");t.src=e,t.async=!0,document.head.appendChild(t)}const i=null==o?void 0:o.init;if(i)try{new Function("context",i)(e)}catch(e){n.error("Code destination init error:",e)}},push(e,t){var n,o;const{mapping:r,config:i,logger:s}=t,a=null!=(o=null==r?void 0:r.push)?o:null==(n=i.settings)?void 0:n.push;if(a)try{new Function("event","context",a)(e,t)}catch(e){s.error("Code destination push error:",e)}},pushBatch(e,t){var n,o;const{mapping:r,config:i,logger:s}=t,a=null!=(o=null==r?void 0:r.pushBatch)?o:null==(n=i.settings)?void 0:n.pushBatch;if(a)try{new Function("batch","context",a)(e,t)}catch(e){s.error("Code destination pushBatch error:",e)}},on(e,t){var n;const{config:o,logger:r}=t,i=null==(n=o.settings)?void 0:n.on;if(i)try{new Function("type","context",i)(e,t)}catch(e){r.error("Code destination on error:",e)}}};function $(e){return!0===e?C:e}async function q(e,t,n){const{allowed:o,consent:r,globals:s,user:a}=e;if(!o)return D({ok:!1});t&&e.queue.push(t),n||(n=e.destinations);const c=await Promise.all(Object.entries(n||{}).map(async([n,o])=>{let c=(o.queue||[]).map(e=>({...e,consent:r}));if(o.queue=[],t){const e=l(t);c.push(e)}if(!c.length)return{id:n,destination:o,skipped:!0};const u=[],d=c.filter(e=>{const t=g(o.config.consent,r,e.consent);return!t||(e.consent=t,u.push(e),!1)});if(o.queue.concat(d),!u.length)return{id:n,destination:o,queue:c};if(!await j(P)(e,o))return{id:n,destination:o,queue:c};let f=!1;return o.dlq||(o.dlq=[]),await Promise.all(u.map(async t=>(t.globals=i(s,t.globals),t.user=i(a,t.user),await j(R,n=>{const r=o.type||"unknown";return e.logger.scope(r).error("Push failed",{error:n,event:t.name}),f=!0,o.dlq.push([t,n]),!1})(e,o,t),t))),{id:n,destination:o,error:f}})),u=[],d=[],f=[];for(const e of c){if(e.skipped)continue;const t=e.destination,n={id:e.id,destination:t};e.error?f.push(n):e.queue&&e.queue.length?(t.queue=(t.queue||[]).concat(e.queue),d.push(n)):u.push(n)}return D({ok:!f.length,event:t,successful:u,queued:d,failed:f})}async function P(e,t){if(t.init&&!t.config.init){const n=t.type||"unknown",o=e.logger.scope(n),r={collector:e,config:t.config,env:I(t.env,t.config.env),logger:o};o.debug("init");const i=await L(t.init,"DestinationInit",e.hooks)(r);if(!1===i)return i;t.config={...i||t.config,init:!0},o.debug("init done")}return!0}async function R(e,t,n){const{config:o}=t,r=await x(n,o,e);if(r.ignore)return!1;const i=t.type||"unknown",s=e.logger.scope(i),c={collector:e,config:o,data:r.data,mapping:r.mapping,env:I(t.env,o.env),logger:s},u=r.mapping,l=r.mappingKey||"* *";if((null==u?void 0:u.batch)&&t.pushBatch){if(t.batches=t.batches||{},!t.batches[l]){const n={key:l,events:[],data:[]};t.batches[l]={batched:n,batchFn:p(()=>{const n=t.batches[l].batched,r={collector:e,config:o,data:void 0,mapping:u,env:I(t.env,o.env),logger:s};s.debug("push batch",{events:n.events.length}),L(t.pushBatch,"DestinationPushBatch",e.hooks)(n,r),s.debug("push batch done"),n.events=[],n.data=[]},u.batch)}}const n=t.batches[l];n.batched.events.push(r.event),a(r.data)&&n.batched.data.push(r.data),n.batchFn()}else s.debug("push",{event:r.event.name}),await L(t.push,"DestinationPush",e.hooks)(r.event,c),s.debug("push done");return!0}function D(e){var t;return i({ok:!(null==(t=null==e?void 0:e.failed)?void 0:t.length),successful:[],queued:[],failed:[]},e)}function I(e,t){return e||t?t?e&&c(e)&&c(t)?{...e,...t}:t:e:{}}function N(e,t,n,o){let r,i=n||[];switch(n||(i=e.on[t]||[]),t){case A.Consent:r=o||e.consent;break;case A.Session:r=e.session;break;case A.Ready:case A.Run:default:r=void 0}if(Object.values(e.sources).forEach(e=>{e.on&&S(e.on)(t,r)}),Object.values(e.destinations).forEach(n=>{if(n.on){const o=n.type||"unknown",i=e.logger.scope(o).scope("on").scope(t),s={collector:e,config:n.config,data:r,env:I(n.env,n.config.env),logger:i};S(n.on)(t,s)}}),i.length)switch(t){case A.Consent:!function(e,t,n){const o=n||e.consent;t.forEach(t=>{Object.keys(o).filter(e=>e in t).forEach(n=>{S(t[n])(e,o)})})}(e,i,o);break;case A.Ready:case A.Run:a=i,(s=e).allowed&&a.forEach(e=>{S(e)(s)});break;case A.Session:!function(e,t){e.session&&t.forEach(t=>{S(t)(e,e.session)})}(e,i)}var s,a}async function X(e,t,n,o){let r;switch(t){case A.Config:c(n)&&i(e.config,n,{shallow:!1});break;case A.Consent:c(n)&&(r=await async function(e,t){const{consent:n}=e;let o=!1;const r={};return Object.entries(t).forEach(([e,t])=>{const n=!!t;r[e]=n,o=o||n}),e.consent=i(n,r),N(e,"consent",void 0,r),o?q(e):D({ok:!0})}(e,n));break;case A.Custom:c(n)&&(e.custom=i(e.custom,n));break;case A.Destination:c(n)&&function(e){return"function"==typeof e}(n.push)&&(r=await async function(e,t,n){const{code:o,config:r={},env:i={}}=t,s=n||r||{init:!1},a=$(o),c={...a,config:s,env:I(a.env,i)};let u=c.config.id;if(!u)do{u=m(4)}while(e.destinations[u]);return e.destinations[u]=c,!1!==c.config.queue&&(c.queue=[...e.queue]),q(e,void 0,{[u]:c})}(e,{code:n},o));break;case A.Globals:c(n)&&(e.globals=i(e.globals,n));break;case A.On:u(n)&&function(e,t,n){const o=e.on,r=o[t]||[],i=s(n)?n:[n];i.forEach(e=>{r.push(e)}),o[t]=r,N(e,t,i)}(e,n,o);break;case A.Ready:N(e,"ready");break;case A.Run:r=await async function(e,t){e.allowed=!0,e.count=0,e.group=m(),e.timing=Date.now(),t&&(t.consent&&(e.consent=i(e.consent,t.consent)),t.user&&(e.user=i(e.user,t.user)),t.globals&&(e.globals=i(e.config.globalsStatic||{},t.globals)),t.custom&&(e.custom=i(e.custom,t.custom))),Object.values(e.destinations).forEach(e=>{e.queue=[]}),e.queue=[],e.round++;const n=await q(e);return N(e,"run"),n}(e,n);break;case A.Session:N(e,"session");break;case A.User:c(n)&&i(e.user,n,{shallow:!1})}return r||{ok:!0,successful:[],queued:[],failed:[]}}function W(e,t){return L(async(n,o={})=>await j(async()=>{let r=n;if(o.mapping){const t=await x(r,o.mapping,e);if(t.ignore)return D({ok:!0});if(o.mapping.consent&&!g(o.mapping.consent,e.consent,t.event.consent))return D({ok:!0});r=t.event}const i=t(r),s=function(e,t){if(!t.name)throw new Error("Event name is required");const[n,o]=t.name.split(" ");if(!n||!o)throw new Error("Event name is invalid");++e.count;const{timestamp:r=Date.now(),group:i=e.group,count:s=e.count}=t,{name:a=`${n} ${o}`,data:c={},context:u={},globals:l=e.globals,custom:d={},user:f=e.user,nested:g=[],consent:m=e.consent,id:p=`${r}-${i}-${s}`,trigger:h="",entity:y=n,action:b=o,timing:v=0,version:w={source:e.version,tagging:e.config.tagging||0},source:k={type:"collector",id:"",previous_id:""}}=t;return{name:a,data:c,context:u,globals:l,custom:d,user:f,nested:g,consent:m,id:p,trigger:h,entity:y,action:b,timestamp:r,timing:v,group:i,count:s,version:w,source:k}}(e,i);return await q(e,s)},()=>D({ok:!1}))(),"Push",e.hooks)}async function T(e){var t,n;const o=i({globalsStatic:{},sessionStatic:{},tagging:0,run:!0},e,{merge:!1,extend:!1}),r=v({level:null==(t=e.logger)?void 0:t.level,handler:null==(n=e.logger)?void 0:n.handler}),s={...o.globalsStatic,...e.globals},a={allowed:!1,config:o,consent:e.consent||{},count:0,custom:e.custom||{},destinations:{},globals:s,group:"",hooks:{},logger:r,on:{},queue:[],round:0,session:void 0,timing:Date.now(),user:e.user||{},version:"0.6.0",sources:{},push:void 0,command:void 0};return a.push=W(a,e=>({timing:Math.round((Date.now()-a.timing)/10)/100,source:{type:"collector",id:"",previous_id:""},...e})),a.command=(u=X,L(async(e,t,n)=>await j(async()=>await u(c,e,t,n),()=>D({ok:!1}))(),"Command",(c=a).hooks)),a.destinations=await async function(e,t={}){const n={};for(const[e,o]of Object.entries(t)){const{code:t,config:r={},env:i={}}=o,s=$(t),a={...s.config,...r},c=I(s.env,i);n[e]={...s,config:a,env:c}}return n}(0,e.destinations||{}),a;var c,u}async function U(e){e=e||{};const t=await T(e),n=(o=t,{type:"elb",config:{},push:async(e,t,n,r,i,s)=>{if("string"==typeof e&&e.startsWith("walker ")){const r=e.replace("walker ","");return o.command(r,t,n)}let a;if("string"==typeof e)a={name:e},t&&"object"==typeof t&&!Array.isArray(t)&&(a.data=t);else{if(!e||"object"!=typeof e)return{ok:!1,successful:[],queued:[],failed:[]};a=e,t&&"object"==typeof t&&!Array.isArray(t)&&(a.data={...a.data||{},...t})}return r&&"object"==typeof r&&(a.context=r),i&&Array.isArray(i)&&(a.nested=i),s&&"object"==typeof s&&(a.custom=s),o.push(a)}});var o;t.sources.elb=n;const r=await async function(e,t={}){const n={};for(const[o,r]of Object.entries(t)){const{code:t,config:i={},env:s={},primary:a}=r,c=(t,n={})=>e.push(t,{...n,mapping:i}),u=e.logger.scope("source").scope(o),l={push:c,command:e.command,sources:e.sources,elb:e.sources.elb.push,logger:u,...s},d=await j(t)(i,l);if(!d)continue;const f=d.type||"unknown",g=e.logger.scope(f).scope(o);l.logger=g,a&&(d.config={...d.config,primary:a}),n[o]=d}return n}(t,e.sources||{});Object.assign(t.sources,r);const{consent:i,user:s,globals:a,custom:c}=e;i&&await t.command("consent",i),s&&await t.command("user",s),a&&Object.assign(t.globals,a),c&&Object.assign(t.custom,c),t.config.run&&await t.command("run");let u=n.push;const l=Object.values(t.sources).filter(e=>"elb"!==e.type),d=l.find(e=>e.config.primary);return d?u=d.push:l.length>0&&(u=l[0].push),{collector:t,elb:u}}function B(e,t){return(e.getAttribute(t)||"").trim()}var M=function(){const e=window;(e.elbLayer=e.elbLayer||[]).push(arguments)};function F(e){const t=getComputedStyle(e);if("none"===t.display)return!1;if("visible"!==t.visibility)return!1;if(t.opacity&&Number(t.opacity)<.1)return!1;let n;const o=window.innerHeight,r=e.getBoundingClientRect(),i=r.height,s=r.y,a=s+i,c={x:r.x+e.offsetWidth/2,y:r.y+e.offsetHeight/2};if(i<=o){if(e.offsetWidth+r.width===0||e.offsetHeight+r.height===0)return!1;if(c.x<0)return!1;if(c.x>(document.documentElement.clientWidth||window.innerWidth))return!1;if(c.y<0)return!1;if(c.y>(document.documentElement.clientHeight||window.innerHeight))return!1;n=document.elementFromPoint(c.x,c.y)}else{const e=o/2;if(s<0&&a<e)return!1;if(a>o&&s>e)return!1;n=document.elementFromPoint(c.x,o/2)}if(n)do{if(n===e)return!0}while(n=n.parentElement);return!1}function G(e,t,n){return!1===n?e:(n||(n=H),n(e,t,H))}var H=(e,t)=>{const n={};return e.id&&(n.session=e.id),e.storage&&e.device&&(n.device=e.device),t?t.command("user",n):M("walker user",n),e.isStart&&(t?t.push({name:"session start",data:e}):M({name:"session start",data:e})),e};function K(e,t=o.Storage.Session){var n;function r(e){try{return JSON.parse(e||"")}catch(t){let n=1,o="";return e&&(n=0,o=e),{e:n,v:o}}}let i,s;switch(t){case o.Storage.Cookie:i=decodeURIComponent((null==(n=document.cookie.split("; ").find(t=>t.startsWith(e+"=")))?void 0:n.split("=")[1])||"");break;case o.Storage.Local:s=r(window.localStorage.getItem(e));break;case o.Storage.Session:s=r(window.sessionStorage.getItem(e))}return s&&(i=s.v,0!=s.e&&s.e<Date.now()&&(function(e,t=o.Storage.Session){switch(t){case o.Storage.Cookie:J(e,"",0,t);break;case o.Storage.Local:window.localStorage.removeItem(e);break;case o.Storage.Session:window.sessionStorage.removeItem(e)}}(e,t),i="")),function(e){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}(i||"")}function J(e,t,n=30,r=o.Storage.Session,i){const s={e:Date.now()+6e4*n,v:String(t)},a=JSON.stringify(s);switch(r){case o.Storage.Cookie:{t="object"==typeof t?JSON.stringify(t):t;let o=`${e}=${encodeURIComponent(t)}; max-age=${60*n}; path=/; SameSite=Lax; secure`;i&&(o+="; domain="+i),document.cookie=o;break}case o.Storage.Local:window.localStorage.setItem(e,a);break;case o.Storage.Session:window.sessionStorage.setItem(e,a)}return K(e,r)}function z(e={}){const t=Date.now(),{length:n=30,deviceKey:o="elbDeviceId",deviceStorage:r="local",deviceAge:i=30,sessionKey:s="elbSessionId",sessionStorage:a="local",pulse:c=!1}=e,u=Y(e);let l=!1;const d=S((e,t,n)=>{let o=K(e,n);return o||(o=m(8),J(e,o,1440*t,n)),String(o)})(o,i,r),f=S((e,o)=>{const r=JSON.parse(String(K(e,o)));return c||(r.isNew=!1,u.marketing&&(Object.assign(r,u),l=!0),l||r.updated+6e4*n<t?(delete r.id,delete r.referrer,r.start=t,r.count++,r.runs=1,l=!0):r.runs++),r},()=>{l=!0})(s,a)||{},g={id:m(12),start:t,isNew:!0,count:1,runs:1},p=Object.assign(g,u,f,{device:d},{isStart:l,storage:!0,updated:t},e.data);return J(s,JSON.stringify(p),2*n,a),p}function Y(e={}){let t=e.isStart||!1;const n={isStart:t,storage:!1};if(!1===e.isStart)return n;if(!t){const[e]=performance.getEntriesByType("navigation");if("navigate"!==e.type)return n}const o=new URL(e.url||window.location.href),r=e.referrer||document.referrer,s=r&&new URL(r).hostname,a=function(e,t={}){const n="clickId",o={},r={utm_campaign:"campaign",utm_content:"content",utm_medium:"medium",utm_source:"source",utm_term:"term",dclid:n,fbclid:n,gclid:n,msclkid:n,ttclid:n,twclid:n,igshid:n,sclid:n};return Object.entries(i(r,t)).forEach(([t,r])=>{const i=e.searchParams.get(t);i&&(r===n&&(r=t,o[n]=t),o[r]=i)}),o}(o,e.parameters);if(Object.keys(a).length&&(a.marketing||(a.marketing=!0),t=!0),!t){const n=e.domains||[];n.push(o.hostname),t=!n.includes(s)}return t?Object.assign({isStart:t,storage:!1,start:Date.now(),id:m(12),referrer:s},a,e.data):n}var V,Q=Object.defineProperty,Z=(e,t)=>{for(var n in t)Q(e,n,{get:t[n],enumerable:!0})},ee=Object.defineProperty;((e,t)=>{for(var n in t)ee(e,n,{get:t[n],enumerable:!0})})({},{Level:()=>te});var te=((V=te||{})[V.ERROR=0]="ERROR",V[V.INFO=1]="INFO",V[V.DEBUG=2]="DEBUG",V),ne={merge:!0,shallow:!0,extend:!0};function oe(e,t={},n={}){n={...ne,...n};const o=Object.entries(t).reduce((t,[o,r])=>{const i=e[o];return n.merge&&Array.isArray(i)&&Array.isArray(r)?t[o]=r.reduce((e,t)=>e.includes(t)?e:[...e,t],[...i]):(n.extend||o in e)&&(t[o]=r),t},{});return n.shallow?{...e,...o}:(Object.assign(e,o),e)}function re(e){return Array.isArray(e)}function ie(e){return e===document||e instanceof Element}function se(e){return"object"==typeof e&&null!==e&&!re(e)&&"[object Object]"===Object.prototype.toString.call(e)}function ae(e){return"string"==typeof e}function ce(e){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}function ue(e,t,n){return function(...o){try{return e(...o)}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}}function le(e){return e?e.trim().replace(/^'|'$/g,"").trim():""}function de(e,t,n=!0){return e+(null!=t?(n?"-":"")+t:"")}function fe(e,t,n,o=!0){return Se(B(t,de(e,n,o))||"").reduce((e,n)=>{let[o,r]=je(n);if(!o)return e;if(r||(o.endsWith(":")&&(o=o.slice(0,-1)),r=""),r.startsWith("#")){r=r.slice(1);try{let e=t[r];e||"selected"!==r||(e=t.options[t.selectedIndex].text),r=String(e)}catch(e){r=""}}return o.endsWith("[]")?(o=o.slice(0,-2),re(e[o])||(e[o]=[]),e[o].push(ce(r))):e[o]=ce(r),e},{})}function ge(e,t=A.Prefix){var n;const o=e||document.body;if(!o)return[];let r=[];const i=A.Action,s=`[${de(t,i,!1)}]`,a=e=>{Object.keys(fe(t,e,i,!1)).forEach(n=>{r=r.concat(me(e,n,t))})};return o!==document&&(null==(n=o.matches)?void 0:n.call(o,s))&&a(o),Ee(o,s,a),r}function me(e,t,n=A.Prefix){const o=[],{actions:r,nearestOnly:i}=function(e,t,n){let o=t;for(;o;){const t=B(o,de(e,A.Actions,!1));if(t){const e=ye(t);if(e[n])return{actions:e[n],nearestOnly:!1}}const r=B(o,de(e,A.Action,!1));if(r){const e=ye(r);if(e[n]||"click"!==n)return{actions:e[n]||[],nearestOnly:!0}}o=we(e,o)}return{actions:[],nearestOnly:!1}}(n,e,t);return r.length?(r.forEach(r=>{const s=Se(r.actionParams||"",",").reduce((e,t)=>(e[le(t)]=!0,e),{}),a=be(n,e,s,i);if(!a.length){const t="page",o=`[${de(n,t)}]`,[r,i]=ke(e,o,n,t);a.push({entity:t,data:r,nested:[],context:i})}a.forEach(e=>{o.push({entity:e.entity,action:r.action,data:e.data,trigger:t,context:e.context,nested:e.nested})})}),o):o}function pe(e=A.Prefix,t=document){const n=de(e,A.Globals,!1);let o={};return Ee(t,`[${n}]`,t=>{o=oe(o,fe(e,t,A.Globals,!1))}),o}function he(e,t){const n=window.location,o="page",r=t===document?document.body:t,[i,s]=ke(r,`[${de(e,o)}]`,e,o);return i.domain=n.hostname,i.title=document.title,i.referrer=document.referrer,n.search&&(i.search=n.search),n.hash&&(i.hash=n.hash),[i,s]}function ye(e){const t={};return Se(e).forEach(e=>{const[n,o]=je(e),[r,i]=Oe(n);if(!r)return;let[s,a]=Oe(o||"");s=s||r,t[r]||(t[r]=[]),t[r].push({trigger:r,triggerParams:i,action:s,actionParams:a})}),t}function be(e,t,n,o=!1){const r=[];let i=t;for(n=0!==Object.keys(n||{}).length?n:void 0;i;){const s=ve(e,i,t,n);if(s&&(r.push(s),o))break;i=we(e,i)}return r}function ve(e,t,n,o){const r=B(t,de(e));if(!r||o&&!o[r])return null;const i=[t],s=`[${de(e,r)}],[${de(e,"")}]`,a=de(e,A.Link,!1);let c={};const u=[],[l,d]=ke(n||t,s,e,r);Ee(t,`[${a}]`,t=>{const[n,o]=je(B(t,a));"parent"===o&&Ee(document.body,`[${a}="${n}:child"]`,t=>{i.push(t);const n=ve(e,t);n&&u.push(n)})});const f=[];i.forEach(e=>{e.matches(s)&&f.push(e),Ee(e,s,e=>f.push(e))});let g={};return f.forEach(t=>{g=oe(g,fe(e,t,"")),c=oe(c,fe(e,t,r))}),c=oe(oe(g,c),l),i.forEach(t=>{Ee(t,`[${de(e)}]`,t=>{const n=ve(e,t);n&&u.push(n)})}),{entity:r,data:c,context:d,nested:u}}function we(e,t){const n=de(e,A.Link,!1);if(t.matches(`[${n}]`)){const[e,o]=je(B(t,n));if("child"===o)return document.querySelector(`[${n}="${e}:parent"]`)}return!t.parentElement&&t.getRootNode&&t.getRootNode()instanceof ShadowRoot?t.getRootNode().host:t.parentElement}function ke(e,t,n,o){let r={};const i={};let s=e;const a=`[${de(n,A.Context,!1)}]`;let c=0;for(;s;)s.matches(t)&&(r=oe(fe(n,s,""),r),r=oe(fe(n,s,o),r)),s.matches(a)&&(Object.entries(fe(n,s,A.Context,!1)).forEach(([e,t])=>{t&&!i[e]&&(i[e]=[t,c])}),++c),s=we(n,s);return[r,i]}function Ee(e,t,n){e.querySelectorAll(t).forEach(n)}function Se(e,t=";"){if(!e)return[];const n=new RegExp(`(?:[^${t}']+|'[^']*')+`,"ig");return e.match(n)||[]}function je(e){const[t,n]=e.split(/:(.+)/,2);return[le(t),le(n)]}function Oe(e){const[t,n]=e.split("(",2);return[t,n?n.slice(0,-1):""]}var _e,xe=new WeakMap,Le=new WeakMap,Ae=new WeakMap;function Ce(e){const t=Date.now();let n=Le.get(e);return(!n||t-n.lastChecked>500)&&(n={isVisible:F(e),lastChecked:t},Le.set(e,n)),n.isVisible}function $e(e){if(window.IntersectionObserver)return ue(()=>new window.IntersectionObserver(t=>{t.forEach(t=>{!function(e,t){var n,o;const r=t.target,i=Ae.get(e);if(!i)return;const s=i.timers.get(r);if(t.intersectionRatio>0){const o=Date.now();let a=xe.get(r);if((!a||o-a.lastChecked>1e3)&&(a={isLarge:r.offsetHeight>window.innerHeight,lastChecked:o},xe.set(r,a)),t.intersectionRatio>=.5||a.isLarge&&Ce(r)){const t=null==(n=i.elementConfigs)?void 0:n.get(r);if((null==t?void 0:t.multiple)&&t.blocked)return;if(!s){const t=window.setTimeout(async()=>{var t,n;if(Ce(r)){const o=null==(t=i.elementConfigs)?void 0:t.get(r);(null==o?void 0:o.context)&&await Fe(o.context,r,o.trigger);const s=null==(n=i.elementConfigs)?void 0:n.get(r);(null==s?void 0:s.multiple)?s.blocked=!0:function(e,t){const n=Ae.get(e);if(!n)return;n.observer&&n.observer.unobserve(t);const o=n.timers.get(t);o&&(clearTimeout(o),n.timers.delete(t)),xe.delete(t),Le.delete(t)}(e,r)}},i.duration);i.timers.set(r,t)}return}}s&&(clearTimeout(s),i.timers.delete(r));const a=null==(o=i.elementConfigs)?void 0:o.get(r);(null==a?void 0:a.multiple)&&(a.blocked=!1)}(e,t)})},{rootMargin:"0px",threshold:[0,.5]}),()=>{})()}function qe(e,t,n={multiple:!1}){var o;const r=e.settings.scope||document,i=Ae.get(r);(null==i?void 0:i.observer)&&t&&(i.elementConfigs||(i.elementConfigs=new WeakMap),i.elementConfigs.set(t,{multiple:null!=(o=n.multiple)&&o,blocked:!1,context:e,trigger:n.multiple?"visible":"impression"}),i.observer.observe(t))}function Pe(e){if(!e)return;const t=Ae.get(e);t&&(t.observer&&t.observer.disconnect(),Ae.delete(e))}function Re(e,t,n,o,r,i,s){const{elb:a,settings:c}=e;if(ae(t)&&t.startsWith("walker "))return a(t,n);if(se(t)){const e=t;return e.source||(e.source=De()),e.globals||(e.globals=pe(c.prefix,c.scope||document)),a(e)}const[u]=String(se(t)?t.name:t).split(" ");let l,d=se(n)?n:{},f={},g=!1;if(ie(n)&&(l=n,g=!0),ie(r)?l=r:se(r)&&Object.keys(r).length&&(f=r),l){const e=be(c.prefix||"data-elb",l).find(e=>e.entity===u);e&&(g&&(d=e.data),f=e.context)}"page"===u&&(d.id=d.id||window.location.pathname);const m=pe(c.prefix,c.scope);return a({name:String(t||""),data:d,context:f,globals:m,nested:i,custom:s,trigger:ae(o)?o:"",source:De()})}function De(){return{type:"browser",id:window.location.href,previous_id:document.referrer}}var Ie=[],Ne="hover",Xe="load",We="pulse",Te="scroll",Ue="wait";function Be(e,t){t.scope&&function(e,t){const n=t.scope;n&&(n.addEventListener("click",ue(function(t){He.call(this,e,t)})),n.addEventListener("submit",ue(function(t){Ke.call(this,e,t)})))}(e,t)}function Me(e,t){t.scope&&function(e,t){const n=t.scope;Ie=[];const o=n||document;Pe(o),function(e,t=1e3){Ae.has(e)||Ae.set(e,{observer:$e(e),timers:new WeakMap,duration:t})}(o,1e3);const r=de(t.prefix,A.Action,!1);o!==document&&Ge(e,o,r,t),o.querySelectorAll(`[${r}]`).forEach(n=>{Ge(e,n,r,t)}),Ie.length&&function(e,t){const n=(e,t)=>e.filter(([e,n])=>{const o=window.scrollY+window.innerHeight,r=e.offsetTop;if(o<r)return!0;const i=e.clientHeight;return!(100*(1-(r+i-o)/(i||1))>=n&&(Fe(t,e,Te),1))});_e||(_e=function(e,t=1e3){let n=null;return function(...o){if(null===n)return n=setTimeout(()=>{n=null},t),e(...o)}}(function(){Ie=n.call(t,Ie,e)}),t.addEventListener("scroll",_e))}(e,o)}(e,t)}async function Fe(e,t,n){const o=me(t,n,e.settings.prefix);return Promise.all(o.map(t=>Re(e,{name:`${t.entity} ${t.action}`,...t,trigger:n})))}function Ge(e,t,n,o){const r=B(t,n);r&&Object.values(ye(r)).forEach(n=>n.forEach(n=>{switch(n.trigger){case Ne:o=e,t.addEventListener("mouseenter",ue(function(e){e.target instanceof Element&&Fe(o,e.target,Ne)}));break;case Xe:!function(e,t){Fe(e,t,Xe)}(e,t);break;case We:!function(e,t,n=""){setInterval(()=>{document.hidden||Fe(e,t,We)},parseInt(n||"")||15e3)}(e,t,n.triggerParams);break;case Te:!function(e,t=""){const n=parseInt(t||"")||50;n<0||n>100||Ie.push([e,n])}(t,n.triggerParams);break;case"impression":qe(e,t);break;case"visible":qe(e,t,{multiple:!0});break;case Ue:!function(e,t,n=""){setTimeout(()=>Fe(e,t,Ue),parseInt(n||"")||15e3)}(e,t,n.triggerParams)}var o}))}function He(e,t){Fe(e,t.target,"click")}function Ke(e,t){t.target&&Fe(e,t.target,"submit")}function Je(e,t,n,o){const r=[];let i=!0;n.forEach(e=>{const t=Ye(e)?[...Array.from(e)]:null!=(n=e)&&"object"==typeof n&&"length"in n&&"number"==typeof n.length?Array.from(e):[e];var n;if(Array.isArray(t)&&0===t.length)return;if(Array.isArray(t)&&1===t.length&&!t[0])return;const s=t[0],a=!se(s)&&ae(s)&&s.startsWith("walker ");if(se(s)){if("object"==typeof s&&0===Object.keys(s).length)return}else{const e=Array.from(t);if(!ae(e[0])||""===e[0].trim())return;const n="walker run";i&&e[0]===n&&(i=!1)}(o&&a||!o&&!a)&&r.push(t)}),r.forEach(n=>{ze(e,t,n)})}function ze(e,t="data-elb",n){ue(()=>{if(Array.isArray(n)){const[o,...r]=n;if(!o||ae(o)&&""===o.trim())return;if(ae(o)&&o.startsWith("walker "))return void e(o,r[0]);Re({elb:e,settings:{prefix:t,scope:document,pageview:!1,session:!1,elb:"",elbLayer:!1}},o,...r)}else if(n&&"object"==typeof n){if(0===Object.keys(n).length)return;e(n)}},()=>{})()}function Ye(e){return null!=e&&"object"==typeof e&&"[object Arguments]"===Object.prototype.toString.call(e)}function Ve(e,t={},n){return function(e={}){const{cb:t,consent:n,collector:o,storage:r}=e;if(!n)return G((r?z:Y)(e),o,t);{const r=function(e,t){let n;return(o,r)=>{if(a(n)&&n===(null==o?void 0:o.group))return;n=null==o?void 0:o.group;let i=()=>Y(e);return e.consent&&g((s(e.consent)?e.consent:[e.consent]).reduce((e,t)=>({...e,[t]:!0}),{}),r)&&(i=()=>z(e)),G(i(),o,t)}}(e,t),i=(s(n)?n:[n]).reduce((e,t)=>({...e,[t]:r}),{});o?o.command("on","consent",i):M("walker on","consent",i)}}({...t,collector:{push:e,group:void 0,command:n}})}Z({},{env:()=>Qe});var Qe={};Z(Qe,{push:()=>nt});var Ze=()=>{},et=()=>()=>Promise.resolve({ok:!0,successful:[],queued:[],failed:[]}),tt={error:Ze,info:Ze,debug:Ze,throw:e=>{throw"string"==typeof e?new Error(e):e},scope:()=>tt},nt={get push(){return et()},get command(){return et()},get elb(){return et()},get window(){return{addEventListener:Ze,removeEventListener:Ze,location:{href:"https://example.com/page",pathname:"/page",search:"?query=test",hash:"#section",host:"example.com",hostname:"example.com",origin:"https://example.com",protocol:"https:"},document:{},navigator:{language:"en-US",userAgent:"Mozilla/5.0 (Test)"},screen:{width:1920,height:1080},innerWidth:1920,innerHeight:1080,pageXOffset:0,pageYOffset:0,scrollX:0,scrollY:0}},get document(){return{addEventListener:Ze,removeEventListener:Ze,querySelector:Ze,querySelectorAll:()=>[],getElementById:Ze,getElementsByClassName:()=>[],getElementsByTagName:()=>[],createElement:()=>({setAttribute:Ze,getAttribute:Ze,addEventListener:Ze,removeEventListener:Ze}),body:{appendChild:Ze,removeChild:Ze},documentElement:{scrollTop:0,scrollLeft:0},readyState:"complete",title:"Test Page",referrer:"",cookie:""}},logger:tt},ot=async(e,t)=>{const{elb:n,command:o,window:r,document:i}=t,s=(null==e?void 0:e.settings)||{},a=r||(void 0!==globalThis.window?globalThis.window:void 0),c=i||(void 0!==globalThis.document?globalThis.document:void 0),u=function(e={},t){return{prefix:"data-elb",pageview:!0,session:!0,elb:"elb",elbLayer:"elbLayer",scope:t||void 0,...e}}(s,c),l={settings:u},d={elb:n,settings:u};if(a&&c){if(!1!==u.elbLayer&&n&&function(e,t={}){const n=t.name||"elbLayer",o=t.window||window;if(!o)return;const r=o;r[n]||(r[n]=[]);const i=r[n];i.push=function(...n){if(Ye(n[0])){const o=[...Array.from(n[0])],r=Array.prototype.push.apply(this,[o]);return ze(e,t.prefix,o),r}const o=Array.prototype.push.apply(this,n);return n.forEach(n=>{ze(e,t.prefix,n)}),o},Array.isArray(i)&&i.length>0&&function(e,t="data-elb",n){Je(e,t,n,!0),Je(e,t,n,!1),n.length=0}(e,t.prefix,i)}(n,{name:ae(u.elbLayer)?u.elbLayer:"elbLayer",prefix:u.prefix,window:a}),u.session&&n){const e="boolean"==typeof u.session?{}:u.session;Ve(n,e,o)}await async function(e,t,n){const o=()=>{e(t,n)};"loading"!==document.readyState?o():document.addEventListener("DOMContentLoaded",o)}(Be,d,u),(()=>{if(Me(d,u),u.pageview){const[e,t]=he(u.prefix||"data-elb",u.scope);Re(d,"page view",e,"load",t)}})(),ae(u.elb)&&u.elb&&(a[u.elb]=(...e)=>{const[t,n,o,r,i,s]=e;return Re(d,t,n,o,r,i,s)})}return{type:"browser",config:l,push:(...e)=>{const[t,n,o,r,i,s]=e;return Re(d,t,n,o,r,i,s)},destroy:async()=>{c&&Pe(u.scope||c)},on:async(e,t)=>{switch(e){case"consent":if(u.session&&t&&n){const e="boolean"==typeof u.session?{}:u.session;Ve(n,e,o)}break;case"session":case"ready":default:break;case"run":if(c&&a&&(Me(d,u),u.pageview)){const[e,t]=he(u.prefix||"data-elb",u.scope);Re(d,"page view",e,"load",t)}}}}},rt=Object.defineProperty,it=(e,t)=>{for(var n in t)rt(e,n,{get:t[n],enumerable:!0})},st=!1;function at(e,t={},n){if(t.filter&&!0===S(()=>t.filter(n),()=>!1)())return;const o=function(e){if(c(e)&&u(e.event)){const{event:t,...n}=e;return{name:t,...n}}return s(e)&&e.length>=2?ct(e):null!=(t=e)&&"object"==typeof t&&"length"in t&&"number"==typeof t.length&&t.length>0?ct(Array.from(e)):null;var t}(n);if(!o)return;const r=`${t.prefix||"dataLayer"} ${o.name}`,{name:i,...a}=o,l={name:r,data:a};S(()=>e(l),()=>{})()}function ct(e){const[t,n,o]=e;if(!u(t))return null;let r,i={};switch(t){case"consent":if(!u(n)||e.length<3)return null;if("default"!==n&&"update"!==n)return null;if(!c(o)||null===o)return null;r=`${t} ${n}`,i={...o};break;case"event":if(!u(n))return null;r=n,c(o)&&(i={...o});break;case"config":if(!u(n))return null;r=`${t} ${n}`,c(o)&&(i={...o});break;case"set":if(u(n))r=`${t} ${n}`,c(o)&&(i={...o});else{if(!c(n))return null;r=`${t} custom`,i={...n}}break;default:return null}return{name:r,...i}}it({},{push:()=>ft});var ut=()=>{},lt=()=>()=>Promise.resolve({ok:!0,successful:[],queued:[],failed:[]}),dt={error:ut,info:ut,debug:ut,throw:e=>{throw"string"==typeof e?new Error(e):e},scope:()=>dt},ft={get push(){return lt()},get command(){return lt()},get elb(){return lt()},get window(){return{dataLayer:[],addEventListener:ut,removeEventListener:ut}},logger:dt};function gt(){return["consent","update",{ad_user_data:"granted",ad_personalization:"granted",ad_storage:"denied",analytics_storage:"granted"}]}function mt(){return["consent","default",{ad_storage:"denied",analytics_storage:"denied",ad_user_data:"denied",ad_personalization:"denied"}]}function pt(){return["event","purchase",{transaction_id:"T_12345",value:25.42,currency:"EUR",items:[{item_id:"SKU_12345",item_name:"Product Name",item_category:"Category",quantity:1,price:25.42}]}]}function ht(){return["event","add_to_cart",{currency:"EUR",value:15.25,items:[{item_id:"SKU_12345",item_name:"Product Name",item_variant:"red",quantity:1,price:15.25}]}]}function yt(){return["event","view_item",{currency:"EUR",value:15.25,items:[{item_id:"SKU_12345",item_name:"Product Name",item_category:"Category",price:15.25}]}]}function bt(){return["config","G-XXXXXXXXXX",{page_title:"Custom Page Title",page_location:"https://example.com/page",send_page_view:!1}]}function vt(){return["set",{currency:"EUR",country:"DE"}]}function wt(){return{event:"custom_event",custom_parameter:"custom_value",user_id:"user123"}}it({},{add_to_cart:()=>ht,config:()=>bt,consentDefault:()=>mt,consentUpdate:()=>gt,directDataLayerEvent:()=>wt,purchase:()=>pt,setCustom:()=>vt,view_item:()=>yt});it({},{add_to_cart:()=>St,config:()=>xt,configGA4:()=>Ot,consentOnlyMapping:()=>Lt,consentUpdate:()=>kt,customEvent:()=>_t,purchase:()=>Et,view_item:()=>jt});var kt={name:"walker consent",settings:{command:{map:{functional:{value:!0},analytics:{key:"analytics_storage",fn:e=>"granted"===e},marketing:{key:"ad_storage",fn:e=>"granted"===e}}}}},Et={name:"order complete",data:{map:{id:"transaction_id",total:"value",currency:"currency",nested:{loop:["items",{map:{type:{value:"product"},data:{map:{id:"item_id",name:"item_name",category:"item_category",quantity:"quantity",price:"price"}}}}]}}}},St={name:"product add",data:{map:{id:"items.0.item_id",name:"items.0.item_name",price:"value",currency:"currency",color:"items.0.item_variant",quantity:"items.0.quantity"}}},jt={name:"product view",data:{map:{id:"items.0.item_id",name:"items.0.item_name",category:"items.0.item_category",price:"items.0.price",currency:"currency"}}},Ot={name:"page view",data:{map:{title:"page_title",url:"page_location"}}},_t={data:{map:{user_id:"user_id",custom_parameter:"custom_parameter"}}},xt={consent:{update:kt},purchase:Et,add_to_cart:St,view_item:jt,"config G-XXXXXXXXXX":Ot,custom_event:_t,"*":{data:{}}},Lt={consent:{update:kt}},At=async(e,t)=>{const{elb:n,window:o}=t,r={name:"dataLayer",prefix:"dataLayer",...null==e?void 0:e.settings},i={settings:r};return o&&(function(e,t){const n=t.settings,o=(null==n?void 0:n.name)||"dataLayer",r=window[o];if(Array.isArray(r)&&!st){st=!0;try{for(const t of r)at(e,n,t)}finally{st=!1}}}(n,i),function(e,t){const n=t.settings,o=(null==n?void 0:n.name)||"dataLayer";window[o]||(window[o]=[]);const r=window[o];if(!Array.isArray(r))return;const i=r.push.bind(r);r.push=function(...t){if(st)return i(...t);st=!0;try{for(const o of t)at(e,n,o)}finally{st=!1}return i(...t)}}(n,i)),{type:"dataLayer",config:i,push:n,destroy:async()=>{const e=r.name||"dataLayer";o&&o[e]&&Array.isArray(o[e])}}};function Ct(){window.dataLayer=window.dataLayer||[];const e=e=>{c(e)&&c(e.source)&&String(e.source.type).includes("dataLayer")||window.dataLayer.push(e)};return{type:"dataLayer",config:{},push:(t,n)=>{e(n.data||t)},pushBatch:t=>{e({name:"batch",batched_event:t.key,events:t.data.length?t.data:t.events})}}}var $t={};async function qt(e={}){const t=i({collector:{destinations:{dataLayer:{code:Ct()}}},browser:{session:!0},dataLayer:!1,elb:"elb",run:!0},e),n={...t.collector,sources:{browser:{code:ot,config:{settings:t.browser},env:{window:"undefined"!=typeof window?window:void 0,document:"undefined"!=typeof document?document:void 0}}}};if(t.dataLayer){const e=c(t.dataLayer)?t.dataLayer:{};n.sources&&(n.sources.dataLayer={code:At,config:{settings:e}})}const o=await U(n);return"undefined"!=typeof window&&(t.elb&&(window[t.elb]=o.elb),t.name&&(window[t.name]=o.collector)),o}var Pt=qt;export{$t as Walkerjs,qt as createWalkerjs,Pt as default,ge as getAllEvents,me as getEvents,pe as getGlobals};//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Collector } from '@walkeros/core';
|
|
2
|
+
import type { SourceBrowser } from '@walkeros/web-source-browser';
|
|
3
|
+
import type { SourceDataLayer } from '@walkeros/web-source-datalayer';
|
|
4
|
+
declare global {
|
|
5
|
+
interface Window {
|
|
6
|
+
[key: string]: DataLayer;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export interface Instance {
|
|
10
|
+
collector: Collector.Instance;
|
|
11
|
+
elb: SourceBrowser.BrowserPush;
|
|
12
|
+
}
|
|
13
|
+
export interface Config {
|
|
14
|
+
collector?: Collector.InitConfig;
|
|
15
|
+
browser?: Partial<SourceBrowser.Settings>;
|
|
16
|
+
dataLayer?: boolean | Partial<SourceDataLayer.Settings>;
|
|
17
|
+
elb?: string;
|
|
18
|
+
name?: string;
|
|
19
|
+
run?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export type DataLayer = undefined | Array<unknown>;
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAoB,MAAM,gBAAgB,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEtE,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;KAC1B;CACF;AAGD,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,SAAS,CAAC,QAAQ,CAAC;IAC9B,GAAG,EAAE,aAAa,CAAC,WAAW,CAAC;CAChC;AAGD,MAAM,WAAW,MAAM;IAErB,SAAS,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC;IAGjC,OAAO,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAG1C,SAAS,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;IAGxD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
|
package/dist/walker.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(()=>{var e=Object.defineProperty;((t,n)=>{for(var o in n)e(t,o,{get:n[o],enumerable:!0})})({},{Level:()=>n});var t,n=((t=n||{})[t.ERROR=0]="ERROR",t[t.INFO=1]="INFO",t[t.DEBUG=2]="DEBUG",t),o={Storage:{Local:"local",Session:"session",Cookie:"cookie"}},r={merge:!0,shallow:!0,extend:!0};function i(e,t={},n={}){n={...r,...n};const o=Object.entries(t).reduce((t,[o,r])=>{const i=e[o];return n.merge&&Array.isArray(i)&&Array.isArray(r)?t[o]=r.reduce((e,t)=>e.includes(t)?e:[...e,t],[...i]):(n.extend||o in e)&&(t[o]=r),t},{});return n.shallow?{...e,...o}:(Object.assign(e,o),e)}function s(e){return Array.isArray(e)}function a(e){return void 0!==e}function c(e){return"object"==typeof e&&null!==e&&!s(e)&&"[object Object]"===Object.prototype.toString.call(e)}function u(e){return"string"==typeof e}function l(e,t=new WeakMap){if("object"!=typeof e||null===e)return e;if(t.has(e))return t.get(e);const n=Object.prototype.toString.call(e);if("[object Object]"===n){const n={};t.set(e,n);for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=l(e[o],t));return n}if("[object Array]"===n){const n=[];return t.set(e,n),e.forEach(e=>{n.push(l(e,t))}),n}if("[object Date]"===n)return new Date(e.getTime());if("[object RegExp]"===n){const t=e;return new RegExp(t.source,t.flags)}return e}function d(e,t="",n){const o=t.split(".");let r=e;for(let e=0;e<o.length;e++){const t=o[e];if("*"===t&&s(r)){const t=o.slice(e+1).join("."),i=[];for(const e of r){const o=d(e,t,n);i.push(o)}return i}if(r=r instanceof Object?r[t]:void 0,!r)break}return a(r)?r:n}function f(e,t,n){if(!c(e))return e;const o=l(e),r=t.split(".");let i=o;for(let e=0;e<r.length;e++){const t=r[e];e===r.length-1?i[t]=n:(t in i&&"object"==typeof i[t]&&null!==i[t]||(i[t]={}),i=i[t])}return o}function g(e,t={},n={}){const o={...t,...n},r={};let i=void 0===e;return Object.keys(o).forEach(t=>{o[t]&&(r[t]=!0,e&&e[t]&&(i=!0))}),!!i&&r}function m(e=6){let t="";for(let n=36;t.length<e;)t+=(Math.random()*n|0).toString(n);return t}function p(e,t=1e3,n=!1){let o,r=null,i=!1;return(...s)=>new Promise(a=>{const c=n&&!i;r&&clearTimeout(r),r=setTimeout(()=>{r=null,n&&!i||(o=e(...s),a(o))},t),c&&(i=!0,o=e(...s),a(o))})}function h(e){return{message:e.message,name:e.name,stack:e.stack,cause:e.cause}}function y(e,t){let n,o={};return e instanceof Error?(n=e.message,o.error=h(e)):n=e,void 0!==t&&(t instanceof Error?o.error=h(t):"object"==typeof t&&null!==t?(o={...o,...t},"error"in o&&o.error instanceof Error&&(o.error=h(o.error))):o.value=t),{message:n,context:o}}var b=(e,t,o,r)=>{const i=`${n[e]}${r.length>0?` [${r.join(":")}]`:""}`,s=Object.keys(o).length>0;0===e?s?console.error(i,t,o):console.error(i,t):s?console.log(i,t,o):console.log(i,t)};function v(e={}){return w({level:void 0!==e.level?(t=e.level,"string"==typeof t?n[t]:t):0,handler:e.handler,scope:[]});var t}function w(e){const{level:t,handler:n,scope:o}=e,r=(e,r,i)=>{if(e<=t){const t=y(r,i);n?n(e,t.message,t.context,o,b):b(e,t.message,t.context,o)}};return{error:(e,t)=>r(0,e,t),info:(e,t)=>r(1,e,t),debug:(e,t)=>r(2,e,t),throw:(e,t)=>{const r=y(e,t);throw n?n(0,r.message,r.context,o,b):b(0,r.message,r.context,o),new Error(r.message)},scope:e=>w({level:t,handler:n,scope:[...o,e]})}}function k(e){return function(e){return"boolean"==typeof e}(e)||u(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!a(e)||s(e)&&e.every(k)||c(e)&&Object.values(e).every(k)}function E(e){return k(e)?e:void 0}function S(e,t,n){return function(...o){try{return e(...o)}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}}function O(e,t,n){return async function(...o){try{return await e(...o)}catch(e){if(!t)return;return await t(e)}finally{await(null==n?void 0:n())}}}async function j(e,t={},n={}){var o;if(!a(e))return;const r=c(e)&&e.consent||n.consent||(null==(o=n.collector)?void 0:o.consent),i=s(t)?t:[t];for(const t of i){const o=await O(_)(e,t,{...n,consent:r});if(a(o))return o}}async function _(e,t,n={}){const{collector:o,consent:r}=n;return(s(t)?t:[t]).reduce(async(t,i)=>{const c=await t;if(c)return c;const l=u(i)?{key:i}:i;if(!Object.keys(l).length)return;const{condition:f,consent:m,fn:p,key:h,loop:y,map:b,set:v,validate:w,value:k}=l;if(f&&!await O(f)(e,i,o))return;if(m&&!g(m,r))return k;let S=a(k)?k:e;if(p&&(S=await O(p)(e,i,n)),h&&(S=d(e,h,k)),y){const[t,o]=y,r="this"===t?[e]:await j(e,t,n);s(r)&&(S=(await Promise.all(r.map(e=>j(e,o,n)))).filter(a))}else b?S=await Object.entries(b).reduce(async(t,[o,r])=>{const i=await t,s=await j(e,r,n);return a(s)&&(i[o]=s),i},Promise.resolve({})):v&&(S=await Promise.all(v.map(t=>_(e,t,n))));w&&!await O(w)(S)&&(S=void 0);const x=E(S);return a(x)?x:E(k)},Promise.resolve(void 0))}async function x(e,t,n){t.policy&&await Promise.all(Object.entries(t.policy).map(async([t,o])=>{const r=await j(e,o,{collector:n});e=f(e,t,r)}));const{eventMapping:o,mappingKey:r}=await async function(e,t){var n;const[o,r]=(e.name||"").split(" ");if(!t||!o||!r)return{};let i,a="",c=o,u=r;const l=t=>{if(t)return(t=s(t)?t:[t]).find(t=>!t.condition||t.condition(e))};t[c]||(c="*");const d=t[c];return d&&(d[u]||(u="*"),i=l(d[u])),i||(c="*",u="*",i=l(null==(n=t[c])?void 0:n[u])),i&&(a=`${c} ${u}`),{eventMapping:i,mappingKey:a}}(e,t.mapping);(null==o?void 0:o.policy)&&await Promise.all(Object.entries(o.policy).map(async([t,o])=>{const r=await j(e,o,{collector:n});e=f(e,t,r)}));let a=t.data&&await j(e,t.data,{collector:n});if(o){if(o.ignore)return{event:e,data:a,mapping:o,mappingKey:r,ignore:!0};if(o.name&&(e.name=o.name),o.data){const t=o.data&&await j(e,o.data,{collector:n});a=c(a)&&c(t)?i(a,t):t}}return{event:e,data:a,mapping:o,mappingKey:r,ignore:!1}}function L(e){return e?e.trim().replace(/^'|'$/g,"").trim():""}function A(e,t,n){return function(...o){let r;const i="post"+t,s=n["pre"+t],a=n[i];return r=s?s({fn:e},...o):e(...o),a&&(r=a({fn:e,result:r},...o)),r}}function C(e,t){return(e.getAttribute(t)||"").trim()}function $(e){const t={};return function(e,t=";"){if(!e)return[];const n=new RegExp(`(?:[^${t}']+|'[^']*')+`,"ig");return e.match(n)||[]}(e).forEach(e=>{const[n,o]=function(e){const[t,n]=e.split(/:(.+)/,2);return[L(t||""),L(n||"")]}(e);n&&("true"===o?t[n]=!0:"false"===o?t[n]=!1:o&&/^\d+$/.test(o)?t[n]=parseInt(o,10):o&&/^\d+\.\d+$/.test(o)?t[n]=parseFloat(o):t[n]=o||!0)}),t}var q=function(){const e=window;(e.elbLayer=e.elbLayer||[]).push(arguments)};function R(e){const t=getComputedStyle(e);if("none"===t.display)return!1;if("visible"!==t.visibility)return!1;if(t.opacity&&Number(t.opacity)<.1)return!1;let n;const o=window.innerHeight,r=e.getBoundingClientRect(),i=r.height,s=r.y,a=s+i,c={x:r.x+e.offsetWidth/2,y:r.y+e.offsetHeight/2};if(i<=o){if(e.offsetWidth+r.width===0||e.offsetHeight+r.height===0)return!1;if(c.x<0)return!1;if(c.x>(document.documentElement.clientWidth||window.innerWidth))return!1;if(c.y<0)return!1;if(c.y>(document.documentElement.clientHeight||window.innerHeight))return!1;n=document.elementFromPoint(c.x,c.y)}else{const e=o/2;if(s<0&&a<e)return!1;if(a>o&&s>e)return!1;n=document.elementFromPoint(c.x,o/2)}if(n)do{if(n===e)return!0}while(n=n.parentElement);return!1}function P(e,t,n){return!1===n?e:(n||(n=D),n(e,t,D))}var D=(e,t)=>{const n={};return e.id&&(n.session=e.id),e.storage&&e.device&&(n.device=e.device),t?t.command("user",n):q("walker user",n),e.isStart&&(t?t.push({name:"session start",data:e}):q({name:"session start",data:e})),e};function I(e,t=o.Storage.Session){var n;function r(e){try{return JSON.parse(e||"")}catch(t){let n=1,o="";return e&&(n=0,o=e),{e:n,v:o}}}let i,s;switch(t){case o.Storage.Cookie:i=decodeURIComponent((null==(n=document.cookie.split("; ").find(t=>t.startsWith(e+"=")))?void 0:n.split("=")[1])||"");break;case o.Storage.Local:s=r(window.localStorage.getItem(e));break;case o.Storage.Session:s=r(window.sessionStorage.getItem(e))}return s&&(i=s.v,0!=s.e&&s.e<Date.now()&&(function(e,t=o.Storage.Session){switch(t){case o.Storage.Cookie:N(e,"",0,t);break;case o.Storage.Local:window.localStorage.removeItem(e);break;case o.Storage.Session:window.sessionStorage.removeItem(e)}}(e,t),i="")),function(e){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}(i||"")}function N(e,t,n=30,r=o.Storage.Session,i){const s={e:Date.now()+6e4*n,v:String(t)},a=JSON.stringify(s);switch(r){case o.Storage.Cookie:{t="object"==typeof t?JSON.stringify(t):t;let o=`${e}=${encodeURIComponent(t)}; max-age=${60*n}; path=/; SameSite=Lax; secure`;i&&(o+="; domain="+i),document.cookie=o;break}case o.Storage.Local:window.localStorage.setItem(e,a);break;case o.Storage.Session:window.sessionStorage.setItem(e,a)}return I(e,r)}function X(e={}){const t=Date.now(),{length:n=30,deviceKey:o="elbDeviceId",deviceStorage:r="local",deviceAge:i=30,sessionKey:s="elbSessionId",sessionStorage:a="local",pulse:c=!1}=e,u=T(e);let l=!1;const d=S((e,t,n)=>{let o=I(e,n);return o||(o=m(8),N(e,o,1440*t,n)),String(o)})(o,i,r),f=S((e,o)=>{const r=JSON.parse(String(I(e,o)));return c||(r.isNew=!1,u.marketing&&(Object.assign(r,u),l=!0),l||r.updated+6e4*n<t?(delete r.id,delete r.referrer,r.start=t,r.count++,r.runs=1,l=!0):r.runs++),r},()=>{l=!0})(s,a)||{},g={id:m(12),start:t,isNew:!0,count:1,runs:1},p=Object.assign(g,u,f,{device:d},{isStart:l,storage:!0,updated:t},e.data);return N(s,JSON.stringify(p),2*n,a),p}function T(e={}){let t=e.isStart||!1;const n={isStart:t,storage:!1};if(!1===e.isStart)return n;if(!t){const[e]=performance.getEntriesByType("navigation");if("navigate"!==e.type)return n}const o=new URL(e.url||window.location.href),r=e.referrer||document.referrer,s=r&&new URL(r).hostname,a=function(e,t={}){const n="clickId",o={},r={utm_campaign:"campaign",utm_content:"content",utm_medium:"medium",utm_source:"source",utm_term:"term",dclid:n,fbclid:n,gclid:n,msclkid:n,ttclid:n,twclid:n,igshid:n,sclid:n};return Object.entries(i(r,t)).forEach(([t,r])=>{const i=e.searchParams.get(t);i&&(r===n&&(r=t,o[n]=t),o[r]=i)}),o}(o,e.parameters);if(Object.keys(a).length&&(a.marketing||(a.marketing=!0),t=!0),!t){const n=e.domains||[];n.push(o.hostname),t=!n.includes(s)}return t?Object.assign({isStart:t,storage:!1,start:Date.now(),id:m(12),referrer:s},a,e.data):n}var U={Action:"action",Actions:"actions",Config:"config",Consent:"consent",Context:"context",Custom:"custom",Destination:"destination",Elb:"elb",Globals:"globals",Hook:"hook",Init:"init",Link:"link",On:"on",Prefix:"data-elb",Ready:"ready",Run:"run",Session:"session",User:"user",Walker:"walker"},W={type:"code",config:{},init(e){const{config:t,logger:n}=e,o=t.settings,r=null==o?void 0:o.scripts;if(r&&"undefined"!=typeof document)for(const e of r){const t=document.createElement("script");t.src=e,t.async=!0,document.head.appendChild(t)}const i=null==o?void 0:o.init;if(i)try{new Function("context",i)(e)}catch(e){n.error("Code destination init error:",e)}},push(e,t){var n,o;const{mapping:r,config:i,logger:s}=t,a=null!=(o=null==r?void 0:r.push)?o:null==(n=i.settings)?void 0:n.push;if(a)try{new Function("event","context",a)(e,t)}catch(e){s.error("Code destination push error:",e)}},pushBatch(e,t){var n,o;const{mapping:r,config:i,logger:s}=t,a=null!=(o=null==r?void 0:r.pushBatch)?o:null==(n=i.settings)?void 0:n.pushBatch;if(a)try{new Function("batch","context",a)(e,t)}catch(e){s.error("Code destination pushBatch error:",e)}},on(e,t){var n;const{config:o,logger:r}=t,i=null==(n=o.settings)?void 0:n.on;if(i)try{new Function("type","context",i)(e,t)}catch(e){r.error("Code destination on error:",e)}}};function B(e){return!0===e?W:e}async function M(e,t,n){const{allowed:o,consent:r,globals:s,user:a}=e;if(!o)return H({ok:!1});t&&e.queue.push(t),n||(n=e.destinations);const c=await Promise.all(Object.entries(n||{}).map(async([n,o])=>{let c=(o.queue||[]).map(e=>({...e,consent:r}));if(o.queue=[],t){const e=l(t);c.push(e)}if(!c.length)return{id:n,destination:o,skipped:!0};const u=[],d=c.filter(e=>{const t=g(o.config.consent,r,e.consent);return!t||(e.consent=t,u.push(e),!1)});if(o.queue.concat(d),!u.length)return{id:n,destination:o,queue:c};if(!await O(F)(e,o))return{id:n,destination:o,queue:c};let f=!1;return o.dlq||(o.dlq=[]),await Promise.all(u.map(async t=>(t.globals=i(s,t.globals),t.user=i(a,t.user),await O(G,n=>{const r=o.type||"unknown";return e.logger.scope(r).error("Push failed",{error:n,event:t.name}),f=!0,o.dlq.push([t,n]),!1})(e,o,t),t))),{id:n,destination:o,error:f}})),u=[],d=[],f=[];for(const e of c){if(e.skipped)continue;const t=e.destination,n={id:e.id,destination:t};e.error?f.push(n):e.queue&&e.queue.length?(t.queue=(t.queue||[]).concat(e.queue),d.push(n)):u.push(n)}return H({ok:!f.length,event:t,successful:u,queued:d,failed:f})}async function F(e,t){if(t.init&&!t.config.init){const n=t.type||"unknown",o=e.logger.scope(n),r={collector:e,config:t.config,env:K(t.env,t.config.env),logger:o};o.debug("init");const i=await A(t.init,"DestinationInit",e.hooks)(r);if(!1===i)return i;t.config={...i||t.config,init:!0},o.debug("init done")}return!0}async function G(e,t,n){const{config:o}=t,r=await x(n,o,e);if(r.ignore)return!1;const i=t.type||"unknown",s=e.logger.scope(i),c={collector:e,config:o,data:r.data,mapping:r.mapping,env:K(t.env,o.env),logger:s},u=r.mapping,l=r.mappingKey||"* *";if((null==u?void 0:u.batch)&&t.pushBatch){if(t.batches=t.batches||{},!t.batches[l]){const n={key:l,events:[],data:[]};t.batches[l]={batched:n,batchFn:p(()=>{const n=t.batches[l].batched,r={collector:e,config:o,data:void 0,mapping:u,env:K(t.env,o.env),logger:s};s.debug("push batch",{events:n.events.length}),A(t.pushBatch,"DestinationPushBatch",e.hooks)(n,r),s.debug("push batch done"),n.events=[],n.data=[]},u.batch)}}const n=t.batches[l];n.batched.events.push(r.event),a(r.data)&&n.batched.data.push(r.data),n.batchFn()}else s.debug("push",{event:r.event.name}),await A(t.push,"DestinationPush",e.hooks)(r.event,c),s.debug("push done");return!0}function H(e){var t;return i({ok:!(null==(t=null==e?void 0:e.failed)?void 0:t.length),successful:[],queued:[],failed:[]},e)}function K(e,t){return e||t?t?e&&c(e)&&c(t)?{...e,...t}:t:e:{}}function J(e,t,n,o){let r,i=n||[];switch(n||(i=e.on[t]||[]),t){case U.Consent:r=o||e.consent;break;case U.Session:r=e.session;break;case U.Ready:case U.Run:default:r=void 0}if(Object.values(e.sources).forEach(e=>{e.on&&S(e.on)(t,r)}),Object.values(e.destinations).forEach(n=>{if(n.on){const o=n.type||"unknown",i=e.logger.scope(o).scope("on").scope(t),s={collector:e,config:n.config,data:r,env:K(n.env,n.config.env),logger:i};S(n.on)(t,s)}}),i.length)switch(t){case U.Consent:!function(e,t,n){const o=n||e.consent;t.forEach(t=>{Object.keys(o).filter(e=>e in t).forEach(n=>{S(t[n])(e,o)})})}(e,i,o);break;case U.Ready:case U.Run:a=i,(s=e).allowed&&a.forEach(e=>{S(e)(s)});break;case U.Session:!function(e,t){e.session&&t.forEach(t=>{S(t)(e,e.session)})}(e,i)}var s,a}async function z(e,t,n,o){let r;switch(t){case U.Config:c(n)&&i(e.config,n,{shallow:!1});break;case U.Consent:c(n)&&(r=await async function(e,t){const{consent:n}=e;let o=!1;const r={};return Object.entries(t).forEach(([e,t])=>{const n=!!t;r[e]=n,o=o||n}),e.consent=i(n,r),J(e,"consent",void 0,r),o?M(e):H({ok:!0})}(e,n));break;case U.Custom:c(n)&&(e.custom=i(e.custom,n));break;case U.Destination:c(n)&&function(e){return"function"==typeof e}(n.push)&&(r=await async function(e,t,n){const{code:o,config:r={},env:i={}}=t,s=n||r||{init:!1},a=B(o),c={...a,config:s,env:K(a.env,i)};let u=c.config.id;if(!u)do{u=m(4)}while(e.destinations[u]);return e.destinations[u]=c,!1!==c.config.queue&&(c.queue=[...e.queue]),M(e,void 0,{[u]:c})}(e,{code:n},o));break;case U.Globals:c(n)&&(e.globals=i(e.globals,n));break;case U.On:u(n)&&function(e,t,n){const o=e.on,r=o[t]||[],i=s(n)?n:[n];i.forEach(e=>{r.push(e)}),o[t]=r,J(e,t,i)}(e,n,o);break;case U.Ready:J(e,"ready");break;case U.Run:r=await async function(e,t){e.allowed=!0,e.count=0,e.group=m(),e.timing=Date.now(),t&&(t.consent&&(e.consent=i(e.consent,t.consent)),t.user&&(e.user=i(e.user,t.user)),t.globals&&(e.globals=i(e.config.globalsStatic||{},t.globals)),t.custom&&(e.custom=i(e.custom,t.custom))),Object.values(e.destinations).forEach(e=>{e.queue=[]}),e.queue=[],e.round++;const n=await M(e);return J(e,"run"),n}(e,n);break;case U.Session:J(e,"session");break;case U.User:c(n)&&i(e.user,n,{shallow:!1})}return r||{ok:!0,successful:[],queued:[],failed:[]}}function Y(e,t){return A(async(n,o={})=>await O(async()=>{let r=n;if(o.mapping){const t=await x(r,o.mapping,e);if(t.ignore)return H({ok:!0});if(o.mapping.consent&&!g(o.mapping.consent,e.consent,t.event.consent))return H({ok:!0});r=t.event}const i=t(r),s=function(e,t){if(!t.name)throw new Error("Event name is required");const[n,o]=t.name.split(" ");if(!n||!o)throw new Error("Event name is invalid");++e.count;const{timestamp:r=Date.now(),group:i=e.group,count:s=e.count}=t,{name:a=`${n} ${o}`,data:c={},context:u={},globals:l=e.globals,custom:d={},user:f=e.user,nested:g=[],consent:m=e.consent,id:p=`${r}-${i}-${s}`,trigger:h="",entity:y=n,action:b=o,timing:v=0,version:w={source:e.version,tagging:e.config.tagging||0},source:k={type:"collector",id:"",previous_id:""}}=t;return{name:a,data:c,context:u,globals:l,custom:d,user:f,nested:g,consent:m,id:p,trigger:h,entity:y,action:b,timestamp:r,timing:v,group:i,count:s,version:w,source:k}}(e,i);return await M(e,s)},()=>H({ok:!1}))(),"Push",e.hooks)}async function V(e){var t,n;const o=i({globalsStatic:{},sessionStatic:{},tagging:0,run:!0},e,{merge:!1,extend:!1}),r=v({level:null==(t=e.logger)?void 0:t.level,handler:null==(n=e.logger)?void 0:n.handler}),s={...o.globalsStatic,...e.globals},a={allowed:!1,config:o,consent:e.consent||{},count:0,custom:e.custom||{},destinations:{},globals:s,group:"",hooks:{},logger:r,on:{},queue:[],round:0,session:void 0,timing:Date.now(),user:e.user||{},version:"0.5.0",sources:{},push:void 0,command:void 0};return a.push=Y(a,e=>({timing:Math.round((Date.now()-a.timing)/10)/100,source:{type:"collector",id:"",previous_id:""},...e})),a.command=(u=z,A(async(e,t,n)=>await O(async()=>await u(c,e,t,n),()=>H({ok:!1}))(),"Command",(c=a).hooks)),a.destinations=await async function(e,t={}){const n={};for(const[e,o]of Object.entries(t)){const{code:t,config:r={},env:i={}}=o,s=B(t),a={...s.config,...r},c=K(s.env,i);n[e]={...s,config:a,env:c}}return n}(0,e.destinations||{}),a;var c,u}async function Q(e){e=e||{};const t=await V(e),n=(o=t,{type:"elb",config:{},push:async(e,t,n,r,i,s)=>{if("string"==typeof e&&e.startsWith("walker ")){const r=e.replace("walker ","");return o.command(r,t,n)}let a;if("string"==typeof e)a={name:e},t&&"object"==typeof t&&!Array.isArray(t)&&(a.data=t);else{if(!e||"object"!=typeof e)return{ok:!1,successful:[],queued:[],failed:[]};a=e,t&&"object"==typeof t&&!Array.isArray(t)&&(a.data={...a.data||{},...t})}return r&&"object"==typeof r&&(a.context=r),i&&Array.isArray(i)&&(a.nested=i),s&&"object"==typeof s&&(a.custom=s),o.push(a)}});var o;t.sources.elb=n;const r=await async function(e,t={}){const n={};for(const[o,r]of Object.entries(t)){const{code:t,config:i={},env:s={},primary:a}=r,c=(t,n={})=>e.push(t,{...n,mapping:i}),u=e.logger.scope("source").scope(o),l={push:c,command:e.command,sources:e.sources,elb:e.sources.elb.push,logger:u,...s},d=await O(t)(i,l);if(!d)continue;const f=d.type||"unknown",g=e.logger.scope(f).scope(o);l.logger=g,a&&(d.config={...d.config,primary:a}),n[o]=d}return n}(t,e.sources||{});Object.assign(t.sources,r);const{consent:i,user:s,globals:a,custom:c}=e;i&&await t.command("consent",i),s&&await t.command("user",s),a&&Object.assign(t.globals,a),c&&Object.assign(t.custom,c),t.config.run&&await t.command("run");let u=n.push;const l=Object.values(t.sources).filter(e=>"elb"!==e.type),d=l.find(e=>e.config.primary);return d?u=d.push:l.length>0&&(u=l[0].push),{collector:t,elb:u}}var Z,ee=Object.defineProperty,te=(e,t)=>{for(var n in t)ee(e,n,{get:t[n],enumerable:!0})},ne=Object.defineProperty;((e,t)=>{for(var n in t)ne(e,n,{get:t[n],enumerable:!0})})({},{Level:()=>oe});var oe=((Z=oe||{})[Z.ERROR=0]="ERROR",Z[Z.INFO=1]="INFO",Z[Z.DEBUG=2]="DEBUG",Z),re={merge:!0,shallow:!0,extend:!0};function ie(e,t={},n={}){n={...re,...n};const o=Object.entries(t).reduce((t,[o,r])=>{const i=e[o];return n.merge&&Array.isArray(i)&&Array.isArray(r)?t[o]=r.reduce((e,t)=>e.includes(t)?e:[...e,t],[...i]):(n.extend||o in e)&&(t[o]=r),t},{});return n.shallow?{...e,...o}:(Object.assign(e,o),e)}function se(e){return Array.isArray(e)}function ae(e){return e===document||e instanceof Element}function ce(e){return"object"==typeof e&&null!==e&&!se(e)&&"[object Object]"===Object.prototype.toString.call(e)}function ue(e){return"string"==typeof e}function le(e){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}function de(e,t,n){return function(...o){try{return e(...o)}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}}function fe(e){return e?e.trim().replace(/^'|'$/g,"").trim():""}function ge(e,t,n=!0){return e+(null!=t?(n?"-":"")+t:"")}function me(e,t,n,o=!0){return Se(C(t,ge(e,n,o))||"").reduce((e,n)=>{let[o,r]=Oe(n);if(!o)return e;if(r||(o.endsWith(":")&&(o=o.slice(0,-1)),r=""),r.startsWith("#")){r=r.slice(1);try{let e=t[r];e||"selected"!==r||(e=t.options[t.selectedIndex].text),r=String(e)}catch(e){r=""}}return o.endsWith("[]")?(o=o.slice(0,-2),se(e[o])||(e[o]=[]),e[o].push(le(r))):e[o]=le(r),e},{})}function pe(e=U.Prefix,t=document){const n=ge(e,U.Globals,!1);let o={};return Ee(t,`[${n}]`,t=>{o=ie(o,me(e,t,U.Globals,!1))}),o}function he(e,t){const n=window.location,o="page",r=t===document?document.body:t,[i,s]=ke(r,`[${ge(e,o)}]`,e,o);return i.domain=n.hostname,i.title=document.title,i.referrer=document.referrer,n.search&&(i.search=n.search),n.hash&&(i.hash=n.hash),[i,s]}function ye(e){const t={};return Se(e).forEach(e=>{const[n,o]=Oe(e),[r,i]=je(n);if(!r)return;let[s,a]=je(o||"");s=s||r,t[r]||(t[r]=[]),t[r].push({trigger:r,triggerParams:i,action:s,actionParams:a})}),t}function be(e,t,n,o=!1){const r=[];let i=t;for(n=0!==Object.keys(n||{}).length?n:void 0;i;){const s=ve(e,i,t,n);if(s&&(r.push(s),o))break;i=we(e,i)}return r}function ve(e,t,n,o){const r=C(t,ge(e));if(!r||o&&!o[r])return null;const i=[t],s=`[${ge(e,r)}],[${ge(e,"")}]`,a=ge(e,U.Link,!1);let c={};const u=[],[l,d]=ke(n||t,s,e,r);Ee(t,`[${a}]`,t=>{const[n,o]=Oe(C(t,a));"parent"===o&&Ee(document.body,`[${a}="${n}:child"]`,t=>{i.push(t);const n=ve(e,t);n&&u.push(n)})});const f=[];i.forEach(e=>{e.matches(s)&&f.push(e),Ee(e,s,e=>f.push(e))});let g={};return f.forEach(t=>{g=ie(g,me(e,t,"")),c=ie(c,me(e,t,r))}),c=ie(ie(g,c),l),i.forEach(t=>{Ee(t,`[${ge(e)}]`,t=>{const n=ve(e,t);n&&u.push(n)})}),{entity:r,data:c,context:d,nested:u}}function we(e,t){const n=ge(e,U.Link,!1);if(t.matches(`[${n}]`)){const[e,o]=Oe(C(t,n));if("child"===o)return document.querySelector(`[${n}="${e}:parent"]`)}return!t.parentElement&&t.getRootNode&&t.getRootNode()instanceof ShadowRoot?t.getRootNode().host:t.parentElement}function ke(e,t,n,o){let r={};const i={};let s=e;const a=`[${ge(n,U.Context,!1)}]`;let c=0;for(;s;)s.matches(t)&&(r=ie(me(n,s,""),r),r=ie(me(n,s,o),r)),s.matches(a)&&(Object.entries(me(n,s,U.Context,!1)).forEach(([e,t])=>{t&&!i[e]&&(i[e]=[t,c])}),++c),s=we(n,s);return[r,i]}function Ee(e,t,n){e.querySelectorAll(t).forEach(n)}function Se(e,t=";"){if(!e)return[];const n=new RegExp(`(?:[^${t}']+|'[^']*')+`,"ig");return e.match(n)||[]}function Oe(e){const[t,n]=e.split(/:(.+)/,2);return[fe(t),fe(n)]}function je(e){const[t,n]=e.split("(",2);return[t,n?n.slice(0,-1):""]}var _e,xe=new WeakMap,Le=new WeakMap,Ae=new WeakMap;function Ce(e){const t=Date.now();let n=Le.get(e);return(!n||t-n.lastChecked>500)&&(n={isVisible:R(e),lastChecked:t},Le.set(e,n)),n.isVisible}function $e(e){if(window.IntersectionObserver)return de(()=>new window.IntersectionObserver(t=>{t.forEach(t=>{!function(e,t){var n,o;const r=t.target,i=Ae.get(e);if(!i)return;const s=i.timers.get(r);if(t.intersectionRatio>0){const o=Date.now();let a=xe.get(r);if((!a||o-a.lastChecked>1e3)&&(a={isLarge:r.offsetHeight>window.innerHeight,lastChecked:o},xe.set(r,a)),t.intersectionRatio>=.5||a.isLarge&&Ce(r)){const t=null==(n=i.elementConfigs)?void 0:n.get(r);if((null==t?void 0:t.multiple)&&t.blocked)return;if(!s){const t=window.setTimeout(async()=>{var t,n;if(Ce(r)){const o=null==(t=i.elementConfigs)?void 0:t.get(r);(null==o?void 0:o.context)&&await Fe(o.context,r,o.trigger);const s=null==(n=i.elementConfigs)?void 0:n.get(r);(null==s?void 0:s.multiple)?s.blocked=!0:function(e,t){const n=Ae.get(e);if(!n)return;n.observer&&n.observer.unobserve(t);const o=n.timers.get(t);o&&(clearTimeout(o),n.timers.delete(t)),xe.delete(t),Le.delete(t)}(e,r)}},i.duration);i.timers.set(r,t)}return}}s&&(clearTimeout(s),i.timers.delete(r));const a=null==(o=i.elementConfigs)?void 0:o.get(r);(null==a?void 0:a.multiple)&&(a.blocked=!1)}(e,t)})},{rootMargin:"0px",threshold:[0,.5]}),()=>{})()}function qe(e,t,n={multiple:!1}){var o;const r=e.settings.scope||document,i=Ae.get(r);(null==i?void 0:i.observer)&&t&&(i.elementConfigs||(i.elementConfigs=new WeakMap),i.elementConfigs.set(t,{multiple:null!=(o=n.multiple)&&o,blocked:!1,context:e,trigger:n.multiple?"visible":"impression"}),i.observer.observe(t))}function Re(e){if(!e)return;const t=Ae.get(e);t&&(t.observer&&t.observer.disconnect(),Ae.delete(e))}function Pe(e,t,n,o,r,i,s){const{elb:a,settings:c}=e;if(ue(t)&&t.startsWith("walker "))return a(t,n);if(ce(t)){const e=t;return e.source||(e.source=De()),e.globals||(e.globals=pe(c.prefix,c.scope||document)),a(e)}const[u]=String(ce(t)?t.name:t).split(" ");let l,d=ce(n)?n:{},f={},g=!1;if(ae(n)&&(l=n,g=!0),ae(r)?l=r:ce(r)&&Object.keys(r).length&&(f=r),l){const e=be(c.prefix||"data-elb",l).find(e=>e.entity===u);e&&(g&&(d=e.data),f=e.context)}"page"===u&&(d.id=d.id||window.location.pathname);const m=pe(c.prefix,c.scope);return a({name:String(t||""),data:d,context:f,globals:m,nested:i,custom:s,trigger:ue(o)?o:"",source:De()})}function De(){return{type:"browser",id:window.location.href,previous_id:document.referrer}}var Ie=[],Ne="hover",Xe="load",Te="pulse",Ue="scroll",We="wait";function Be(e,t){t.scope&&function(e,t){const n=t.scope;n&&(n.addEventListener("click",de(function(t){He.call(this,e,t)})),n.addEventListener("submit",de(function(t){Ke.call(this,e,t)})))}(e,t)}function Me(e,t){t.scope&&function(e,t){const n=t.scope;Ie=[];const o=n||document;Re(o),function(e,t=1e3){Ae.has(e)||Ae.set(e,{observer:$e(e),timers:new WeakMap,duration:t})}(o,1e3);const r=ge(t.prefix,U.Action,!1);o!==document&&Ge(e,o,r,t),o.querySelectorAll(`[${r}]`).forEach(n=>{Ge(e,n,r,t)}),Ie.length&&function(e,t){const n=(e,t)=>e.filter(([e,n])=>{const o=window.scrollY+window.innerHeight,r=e.offsetTop;if(o<r)return!0;const i=e.clientHeight;return!(100*(1-(r+i-o)/(i||1))>=n&&(Fe(t,e,Ue),1))});_e||(_e=function(e,t=1e3){let n=null;return function(...o){if(null===n)return n=setTimeout(()=>{n=null},t),e(...o)}}(function(){Ie=n.call(t,Ie,e)}),t.addEventListener("scroll",_e))}(e,o)}(e,t)}async function Fe(e,t,n){const o=function(e,t,n=U.Prefix){const o=[],{actions:r,nearestOnly:i}=function(e,t,n){let o=t;for(;o;){const t=C(o,ge(e,U.Actions,!1));if(t){const e=ye(t);if(e[n])return{actions:e[n],nearestOnly:!1}}const r=C(o,ge(e,U.Action,!1));if(r){const e=ye(r);if(e[n]||"click"!==n)return{actions:e[n]||[],nearestOnly:!0}}o=we(e,o)}return{actions:[],nearestOnly:!1}}(n,e,t);return r.length?(r.forEach(r=>{const s=Se(r.actionParams||"",",").reduce((e,t)=>(e[fe(t)]=!0,e),{}),a=be(n,e,s,i);if(!a.length){const t="page",o=`[${ge(n,t)}]`,[r,i]=ke(e,o,n,t);a.push({entity:t,data:r,nested:[],context:i})}a.forEach(e=>{o.push({entity:e.entity,action:r.action,data:e.data,trigger:t,context:e.context,nested:e.nested})})}),o):o}(t,n,e.settings.prefix);return Promise.all(o.map(t=>Pe(e,{name:`${t.entity} ${t.action}`,...t,trigger:n})))}function Ge(e,t,n,o){const r=C(t,n);r&&Object.values(ye(r)).forEach(n=>n.forEach(n=>{switch(n.trigger){case Ne:o=e,t.addEventListener("mouseenter",de(function(e){e.target instanceof Element&&Fe(o,e.target,Ne)}));break;case Xe:!function(e,t){Fe(e,t,Xe)}(e,t);break;case Te:!function(e,t,n=""){setInterval(()=>{document.hidden||Fe(e,t,Te)},parseInt(n||"")||15e3)}(e,t,n.triggerParams);break;case Ue:!function(e,t=""){const n=parseInt(t||"")||50;n<0||n>100||Ie.push([e,n])}(t,n.triggerParams);break;case"impression":qe(e,t);break;case"visible":qe(e,t,{multiple:!0});break;case We:!function(e,t,n=""){setTimeout(()=>Fe(e,t,We),parseInt(n||"")||15e3)}(e,t,n.triggerParams)}var o}))}function He(e,t){Fe(e,t.target,"click")}function Ke(e,t){t.target&&Fe(e,t.target,"submit")}function Je(e,t,n,o){const r=[];let i=!0;n.forEach(e=>{const t=Ye(e)?[...Array.from(e)]:null!=(n=e)&&"object"==typeof n&&"length"in n&&"number"==typeof n.length?Array.from(e):[e];var n;if(Array.isArray(t)&&0===t.length)return;if(Array.isArray(t)&&1===t.length&&!t[0])return;const s=t[0],a=!ce(s)&&ue(s)&&s.startsWith("walker ");if(ce(s)){if("object"==typeof s&&0===Object.keys(s).length)return}else{const e=Array.from(t);if(!ue(e[0])||""===e[0].trim())return;const n="walker run";i&&e[0]===n&&(i=!1)}(o&&a||!o&&!a)&&r.push(t)}),r.forEach(n=>{ze(e,t,n)})}function ze(e,t="data-elb",n){de(()=>{if(Array.isArray(n)){const[o,...r]=n;if(!o||ue(o)&&""===o.trim())return;if(ue(o)&&o.startsWith("walker "))return void e(o,r[0]);Pe({elb:e,settings:{prefix:t,scope:document,pageview:!1,session:!1,elb:"",elbLayer:!1}},o,...r)}else if(n&&"object"==typeof n){if(0===Object.keys(n).length)return;e(n)}},()=>{})()}function Ye(e){return null!=e&&"object"==typeof e&&"[object Arguments]"===Object.prototype.toString.call(e)}function Ve(e,t={},n){return function(e={}){const{cb:t,consent:n,collector:o,storage:r}=e;if(!n)return P((r?X:T)(e),o,t);{const r=function(e,t){let n;return(o,r)=>{if(a(n)&&n===(null==o?void 0:o.group))return;n=null==o?void 0:o.group;let i=()=>T(e);return e.consent&&g((s(e.consent)?e.consent:[e.consent]).reduce((e,t)=>({...e,[t]:!0}),{}),r)&&(i=()=>X(e)),P(i(),o,t)}}(e,t),i=(s(n)?n:[n]).reduce((e,t)=>({...e,[t]:r}),{});o?o.command("on","consent",i):q("walker on","consent",i)}}({...t,collector:{push:e,group:void 0,command:n}})}te({},{env:()=>Qe});var Qe={};te(Qe,{push:()=>nt});var Ze=()=>{},et=()=>()=>Promise.resolve({ok:!0,successful:[],queued:[],failed:[]}),tt={error:Ze,info:Ze,debug:Ze,throw:e=>{throw"string"==typeof e?new Error(e):e},scope:()=>tt},nt={get push(){return et()},get command(){return et()},get elb(){return et()},get window(){return{addEventListener:Ze,removeEventListener:Ze,location:{href:"https://example.com/page",pathname:"/page",search:"?query=test",hash:"#section",host:"example.com",hostname:"example.com",origin:"https://example.com",protocol:"https:"},document:{},navigator:{language:"en-US",userAgent:"Mozilla/5.0 (Test)"},screen:{width:1920,height:1080},innerWidth:1920,innerHeight:1080,pageXOffset:0,pageYOffset:0,scrollX:0,scrollY:0}},get document(){return{addEventListener:Ze,removeEventListener:Ze,querySelector:Ze,querySelectorAll:()=>[],getElementById:Ze,getElementsByClassName:()=>[],getElementsByTagName:()=>[],createElement:()=>({setAttribute:Ze,getAttribute:Ze,addEventListener:Ze,removeEventListener:Ze}),body:{appendChild:Ze,removeChild:Ze},documentElement:{scrollTop:0,scrollLeft:0},readyState:"complete",title:"Test Page",referrer:"",cookie:""}},logger:tt},ot=async(e,t)=>{const{elb:n,command:o,window:r,document:i}=t,s=(null==e?void 0:e.settings)||{},a=r||(void 0!==globalThis.window?globalThis.window:void 0),c=i||(void 0!==globalThis.document?globalThis.document:void 0),u=function(e={},t){return{prefix:"data-elb",pageview:!0,session:!0,elb:"elb",elbLayer:"elbLayer",scope:t||void 0,...e}}(s,c),l={settings:u},d={elb:n,settings:u};if(a&&c){if(!1!==u.elbLayer&&n&&function(e,t={}){const n=t.name||"elbLayer",o=t.window||window;if(!o)return;const r=o;r[n]||(r[n]=[]);const i=r[n];i.push=function(...n){if(Ye(n[0])){const o=[...Array.from(n[0])],r=Array.prototype.push.apply(this,[o]);return ze(e,t.prefix,o),r}const o=Array.prototype.push.apply(this,n);return n.forEach(n=>{ze(e,t.prefix,n)}),o},Array.isArray(i)&&i.length>0&&function(e,t="data-elb",n){Je(e,t,n,!0),Je(e,t,n,!1),n.length=0}(e,t.prefix,i)}(n,{name:ue(u.elbLayer)?u.elbLayer:"elbLayer",prefix:u.prefix,window:a}),u.session&&n){const e="boolean"==typeof u.session?{}:u.session;Ve(n,e,o)}await async function(e,t,n){const o=()=>{e(t,n)};"loading"!==document.readyState?o():document.addEventListener("DOMContentLoaded",o)}(Be,d,u),(()=>{if(Me(d,u),u.pageview){const[e,t]=he(u.prefix||"data-elb",u.scope);Pe(d,"page view",e,"load",t)}})(),ue(u.elb)&&u.elb&&(a[u.elb]=(...e)=>{const[t,n,o,r,i,s]=e;return Pe(d,t,n,o,r,i,s)})}return{type:"browser",config:l,push:(...e)=>{const[t,n,o,r,i,s]=e;return Pe(d,t,n,o,r,i,s)},destroy:async()=>{c&&Re(u.scope||c)},on:async(e,t)=>{switch(e){case"consent":if(u.session&&t&&n){const e="boolean"==typeof u.session?{}:u.session;Ve(n,e,o)}break;case"session":case"ready":default:break;case"run":if(c&&a&&(Me(d,u),u.pageview)){const[e,t]=he(u.prefix||"data-elb",u.scope);Pe(d,"page view",e,"load",t)}}}}},rt=Object.defineProperty,it=(e,t)=>{for(var n in t)rt(e,n,{get:t[n],enumerable:!0})},st=!1;function at(e,t={},n){if(t.filter&&!0===S(()=>t.filter(n),()=>!1)())return;const o=function(e){if(c(e)&&u(e.event)){const{event:t,...n}=e;return{name:t,...n}}return s(e)&&e.length>=2?ct(e):null!=(t=e)&&"object"==typeof t&&"length"in t&&"number"==typeof t.length&&t.length>0?ct(Array.from(e)):null;var t}(n);if(!o)return;const r=`${t.prefix||"dataLayer"} ${o.name}`,{name:i,...a}=o,l={name:r,data:a};S(()=>e(l),()=>{})()}function ct(e){const[t,n,o]=e;if(!u(t))return null;let r,i={};switch(t){case"consent":if(!u(n)||e.length<3)return null;if("default"!==n&&"update"!==n)return null;if(!c(o)||null===o)return null;r=`${t} ${n}`,i={...o};break;case"event":if(!u(n))return null;r=n,c(o)&&(i={...o});break;case"config":if(!u(n))return null;r=`${t} ${n}`,c(o)&&(i={...o});break;case"set":if(u(n))r=`${t} ${n}`,c(o)&&(i={...o});else{if(!c(n))return null;r=`${t} custom`,i={...n}}break;default:return null}return{name:r,...i}}it({},{push:()=>ft});var ut=()=>{},lt=()=>()=>Promise.resolve({ok:!0,successful:[],queued:[],failed:[]}),dt={error:ut,info:ut,debug:ut,throw:e=>{throw"string"==typeof e?new Error(e):e},scope:()=>dt},ft={get push(){return lt()},get command(){return lt()},get elb(){return lt()},get window(){return{dataLayer:[],addEventListener:ut,removeEventListener:ut}},logger:dt};function gt(){return["consent","update",{ad_user_data:"granted",ad_personalization:"granted",ad_storage:"denied",analytics_storage:"granted"}]}function mt(){return["consent","default",{ad_storage:"denied",analytics_storage:"denied",ad_user_data:"denied",ad_personalization:"denied"}]}function pt(){return["event","purchase",{transaction_id:"T_12345",value:25.42,currency:"EUR",items:[{item_id:"SKU_12345",item_name:"Product Name",item_category:"Category",quantity:1,price:25.42}]}]}function ht(){return["event","add_to_cart",{currency:"EUR",value:15.25,items:[{item_id:"SKU_12345",item_name:"Product Name",item_variant:"red",quantity:1,price:15.25}]}]}function yt(){return["event","view_item",{currency:"EUR",value:15.25,items:[{item_id:"SKU_12345",item_name:"Product Name",item_category:"Category",price:15.25}]}]}function bt(){return["config","G-XXXXXXXXXX",{page_title:"Custom Page Title",page_location:"https://example.com/page",send_page_view:!1}]}function vt(){return["set",{currency:"EUR",country:"DE"}]}function wt(){return{event:"custom_event",custom_parameter:"custom_value",user_id:"user123"}}it({},{add_to_cart:()=>ht,config:()=>bt,consentDefault:()=>mt,consentUpdate:()=>gt,directDataLayerEvent:()=>wt,purchase:()=>pt,setCustom:()=>vt,view_item:()=>yt});it({},{add_to_cart:()=>St,config:()=>xt,configGA4:()=>jt,consentOnlyMapping:()=>Lt,consentUpdate:()=>kt,customEvent:()=>_t,purchase:()=>Et,view_item:()=>Ot});var kt={name:"walker consent",settings:{command:{map:{functional:{value:!0},analytics:{key:"analytics_storage",fn:e=>"granted"===e},marketing:{key:"ad_storage",fn:e=>"granted"===e}}}}},Et={name:"order complete",data:{map:{id:"transaction_id",total:"value",currency:"currency",nested:{loop:["items",{map:{type:{value:"product"},data:{map:{id:"item_id",name:"item_name",category:"item_category",quantity:"quantity",price:"price"}}}}]}}}},St={name:"product add",data:{map:{id:"items.0.item_id",name:"items.0.item_name",price:"value",currency:"currency",color:"items.0.item_variant",quantity:"items.0.quantity"}}},Ot={name:"product view",data:{map:{id:"items.0.item_id",name:"items.0.item_name",category:"items.0.item_category",price:"items.0.price",currency:"currency"}}},jt={name:"page view",data:{map:{title:"page_title",url:"page_location"}}},_t={data:{map:{user_id:"user_id",custom_parameter:"custom_parameter"}}},xt={consent:{update:kt},purchase:Et,add_to_cart:St,view_item:Ot,"config G-XXXXXXXXXX":jt,custom_event:_t,"*":{data:{}}},Lt={consent:{update:kt}},At=async(e,t)=>{const{elb:n,window:o}=t,r={name:"dataLayer",prefix:"dataLayer",...null==e?void 0:e.settings},i={settings:r};return o&&(function(e,t){const n=t.settings,o=(null==n?void 0:n.name)||"dataLayer",r=window[o];if(Array.isArray(r)&&!st){st=!0;try{for(const t of r)at(e,n,t)}finally{st=!1}}}(n,i),function(e,t){const n=t.settings,o=(null==n?void 0:n.name)||"dataLayer";window[o]||(window[o]=[]);const r=window[o];if(!Array.isArray(r))return;const i=r.push.bind(r);r.push=function(...t){if(st)return i(...t);st=!0;try{for(const o of t)at(e,n,o)}finally{st=!1}return i(...t)}}(n,i)),{type:"dataLayer",config:i,push:n,destroy:async()=>{const e=r.name||"dataLayer";o&&o[e]&&Array.isArray(o[e])}}};function Ct(){window.dataLayer=window.dataLayer||[];const e=e=>{c(e)&&c(e.source)&&String(e.source.type).includes("dataLayer")||window.dataLayer.push(e)};return{type:"dataLayer",config:{},push:(t,n)=>{e(n.data||t)},pushBatch:t=>{e({name:"batch",batched_event:t.key,events:t.data.length?t.data:t.events})}}}if(window&&document){const e=async()=>{let e;const t=document.querySelector("script[data-elbconfig]");if(t){const n=t.getAttribute("data-elbconfig")||"";n.includes(":")?e=$(n):n&&(e=window[n])}e||(e=window.elbConfig),e&&await async function(e={}){const t=i({collector:{destinations:{dataLayer:{code:Ct()}}},browser:{session:!0},dataLayer:!1,elb:"elb",run:!0},e),n={...t.collector,sources:{browser:{code:ot,config:{settings:t.browser},env:{window:"undefined"!=typeof window?window:void 0,document:"undefined"!=typeof document?document:void 0}}}};if(t.dataLayer){const e=c(t.dataLayer)?t.dataLayer:{};n.sources&&(n.sources.dataLayer={code:At,config:{settings:e}})}const o=await Q(n);return"undefined"!=typeof window&&(t.elb&&(window[t.elb]=o.elb),t.name&&(window[t.name]=o.collector)),o}(e)};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e()}})();
|
|
1
|
+
"use strict";(()=>{var e=Object.defineProperty;((t,n)=>{for(var o in n)e(t,o,{get:n[o],enumerable:!0})})({},{Level:()=>n});var t,n=((t=n||{})[t.ERROR=0]="ERROR",t[t.INFO=1]="INFO",t[t.DEBUG=2]="DEBUG",t),o={Storage:{Local:"local",Session:"session",Cookie:"cookie"}},r={merge:!0,shallow:!0,extend:!0};function i(e,t={},n={}){n={...r,...n};const o=Object.entries(t).reduce((t,[o,r])=>{const i=e[o];return n.merge&&Array.isArray(i)&&Array.isArray(r)?t[o]=r.reduce((e,t)=>e.includes(t)?e:[...e,t],[...i]):(n.extend||o in e)&&(t[o]=r),t},{});return n.shallow?{...e,...o}:(Object.assign(e,o),e)}function s(e){return Array.isArray(e)}function a(e){return void 0!==e}function c(e){return"object"==typeof e&&null!==e&&!s(e)&&"[object Object]"===Object.prototype.toString.call(e)}function u(e){return"string"==typeof e}function l(e,t=new WeakMap){if("object"!=typeof e||null===e)return e;if(t.has(e))return t.get(e);const n=Object.prototype.toString.call(e);if("[object Object]"===n){const n={};t.set(e,n);for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=l(e[o],t));return n}if("[object Array]"===n){const n=[];return t.set(e,n),e.forEach(e=>{n.push(l(e,t))}),n}if("[object Date]"===n)return new Date(e.getTime());if("[object RegExp]"===n){const t=e;return new RegExp(t.source,t.flags)}return e}function d(e,t="",n){const o=t.split(".");let r=e;for(let e=0;e<o.length;e++){const t=o[e];if("*"===t&&s(r)){const t=o.slice(e+1).join("."),i=[];for(const e of r){const o=d(e,t,n);i.push(o)}return i}if(r=r instanceof Object?r[t]:void 0,!r)break}return a(r)?r:n}function f(e,t,n){if(!c(e))return e;const o=l(e),r=t.split(".");let i=o;for(let e=0;e<r.length;e++){const t=r[e];e===r.length-1?i[t]=n:(t in i&&"object"==typeof i[t]&&null!==i[t]||(i[t]={}),i=i[t])}return o}function g(e,t={},n={}){const o={...t,...n},r={};let i=void 0===e;return Object.keys(o).forEach(t=>{o[t]&&(r[t]=!0,e&&e[t]&&(i=!0))}),!!i&&r}function m(e=6){let t="";for(let n=36;t.length<e;)t+=(Math.random()*n|0).toString(n);return t}function p(e,t=1e3,n=!1){let o,r=null,i=!1;return(...s)=>new Promise(a=>{const c=n&&!i;r&&clearTimeout(r),r=setTimeout(()=>{r=null,n&&!i||(o=e(...s),a(o))},t),c&&(i=!0,o=e(...s),a(o))})}function h(e){return{message:e.message,name:e.name,stack:e.stack,cause:e.cause}}function y(e,t){let n,o={};return e instanceof Error?(n=e.message,o.error=h(e)):n=e,void 0!==t&&(t instanceof Error?o.error=h(t):"object"==typeof t&&null!==t?(o={...o,...t},"error"in o&&o.error instanceof Error&&(o.error=h(o.error))):o.value=t),{message:n,context:o}}var b=(e,t,o,r)=>{const i=`${n[e]}${r.length>0?` [${r.join(":")}]`:""}`,s=Object.keys(o).length>0;0===e?s?console.error(i,t,o):console.error(i,t):s?console.log(i,t,o):console.log(i,t)};function v(e={}){return w({level:void 0!==e.level?(t=e.level,"string"==typeof t?n[t]:t):0,handler:e.handler,scope:[]});var t}function w(e){const{level:t,handler:n,scope:o}=e,r=(e,r,i)=>{if(e<=t){const t=y(r,i);n?n(e,t.message,t.context,o,b):b(e,t.message,t.context,o)}};return{error:(e,t)=>r(0,e,t),info:(e,t)=>r(1,e,t),debug:(e,t)=>r(2,e,t),throw:(e,t)=>{const r=y(e,t);throw n?n(0,r.message,r.context,o,b):b(0,r.message,r.context,o),new Error(r.message)},scope:e=>w({level:t,handler:n,scope:[...o,e]})}}function k(e){return function(e){return"boolean"==typeof e}(e)||u(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!a(e)||s(e)&&e.every(k)||c(e)&&Object.values(e).every(k)}function E(e){return k(e)?e:void 0}function S(e,t,n){return function(...o){try{return e(...o)}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}}function O(e,t,n){return async function(...o){try{return await e(...o)}catch(e){if(!t)return;return await t(e)}finally{await(null==n?void 0:n())}}}async function j(e,t={},n={}){var o;if(!a(e))return;const r=c(e)&&e.consent||n.consent||(null==(o=n.collector)?void 0:o.consent),i=s(t)?t:[t];for(const t of i){const o=await O(_)(e,t,{...n,consent:r});if(a(o))return o}}async function _(e,t,n={}){const{collector:o,consent:r}=n;return(s(t)?t:[t]).reduce(async(t,i)=>{const c=await t;if(c)return c;const l=u(i)?{key:i}:i;if(!Object.keys(l).length)return;const{condition:f,consent:m,fn:p,key:h,loop:y,map:b,set:v,validate:w,value:k}=l;if(f&&!await O(f)(e,i,o))return;if(m&&!g(m,r))return k;let S=a(k)?k:e;if(p&&(S=await O(p)(e,i,n)),h&&(S=d(e,h,k)),y){const[t,o]=y,r="this"===t?[e]:await j(e,t,n);s(r)&&(S=(await Promise.all(r.map(e=>j(e,o,n)))).filter(a))}else b?S=await Object.entries(b).reduce(async(t,[o,r])=>{const i=await t,s=await j(e,r,n);return a(s)&&(i[o]=s),i},Promise.resolve({})):v&&(S=await Promise.all(v.map(t=>_(e,t,n))));w&&!await O(w)(S)&&(S=void 0);const x=E(S);return a(x)?x:E(k)},Promise.resolve(void 0))}async function x(e,t,n){t.policy&&await Promise.all(Object.entries(t.policy).map(async([t,o])=>{const r=await j(e,o,{collector:n});e=f(e,t,r)}));const{eventMapping:o,mappingKey:r}=await async function(e,t){var n;const[o,r]=(e.name||"").split(" ");if(!t||!o||!r)return{};let i,a="",c=o,u=r;const l=t=>{if(t)return(t=s(t)?t:[t]).find(t=>!t.condition||t.condition(e))};t[c]||(c="*");const d=t[c];return d&&(d[u]||(u="*"),i=l(d[u])),i||(c="*",u="*",i=l(null==(n=t[c])?void 0:n[u])),i&&(a=`${c} ${u}`),{eventMapping:i,mappingKey:a}}(e,t.mapping);(null==o?void 0:o.policy)&&await Promise.all(Object.entries(o.policy).map(async([t,o])=>{const r=await j(e,o,{collector:n});e=f(e,t,r)}));let a=t.data&&await j(e,t.data,{collector:n});if(o){if(o.ignore)return{event:e,data:a,mapping:o,mappingKey:r,ignore:!0};if(o.name&&(e.name=o.name),o.data){const t=o.data&&await j(e,o.data,{collector:n});a=c(a)&&c(t)?i(a,t):t}}return{event:e,data:a,mapping:o,mappingKey:r,ignore:!1}}function L(e){return e?e.trim().replace(/^'|'$/g,"").trim():""}function A(e,t,n){return function(...o){let r;const i="post"+t,s=n["pre"+t],a=n[i];return r=s?s({fn:e},...o):e(...o),a&&(r=a({fn:e,result:r},...o)),r}}function C(e,t){return(e.getAttribute(t)||"").trim()}function $(e){const t={};return function(e,t=";"){if(!e)return[];const n=new RegExp(`(?:[^${t}']+|'[^']*')+`,"ig");return e.match(n)||[]}(e).forEach(e=>{const[n,o]=function(e){const[t,n]=e.split(/:(.+)/,2);return[L(t||""),L(n||"")]}(e);n&&("true"===o?t[n]=!0:"false"===o?t[n]=!1:o&&/^\d+$/.test(o)?t[n]=parseInt(o,10):o&&/^\d+\.\d+$/.test(o)?t[n]=parseFloat(o):t[n]=o||!0)}),t}var q=function(){const e=window;(e.elbLayer=e.elbLayer||[]).push(arguments)};function R(e){const t=getComputedStyle(e);if("none"===t.display)return!1;if("visible"!==t.visibility)return!1;if(t.opacity&&Number(t.opacity)<.1)return!1;let n;const o=window.innerHeight,r=e.getBoundingClientRect(),i=r.height,s=r.y,a=s+i,c={x:r.x+e.offsetWidth/2,y:r.y+e.offsetHeight/2};if(i<=o){if(e.offsetWidth+r.width===0||e.offsetHeight+r.height===0)return!1;if(c.x<0)return!1;if(c.x>(document.documentElement.clientWidth||window.innerWidth))return!1;if(c.y<0)return!1;if(c.y>(document.documentElement.clientHeight||window.innerHeight))return!1;n=document.elementFromPoint(c.x,c.y)}else{const e=o/2;if(s<0&&a<e)return!1;if(a>o&&s>e)return!1;n=document.elementFromPoint(c.x,o/2)}if(n)do{if(n===e)return!0}while(n=n.parentElement);return!1}function P(e,t,n){return!1===n?e:(n||(n=D),n(e,t,D))}var D=(e,t)=>{const n={};return e.id&&(n.session=e.id),e.storage&&e.device&&(n.device=e.device),t?t.command("user",n):q("walker user",n),e.isStart&&(t?t.push({name:"session start",data:e}):q({name:"session start",data:e})),e};function I(e,t=o.Storage.Session){var n;function r(e){try{return JSON.parse(e||"")}catch(t){let n=1,o="";return e&&(n=0,o=e),{e:n,v:o}}}let i,s;switch(t){case o.Storage.Cookie:i=decodeURIComponent((null==(n=document.cookie.split("; ").find(t=>t.startsWith(e+"=")))?void 0:n.split("=")[1])||"");break;case o.Storage.Local:s=r(window.localStorage.getItem(e));break;case o.Storage.Session:s=r(window.sessionStorage.getItem(e))}return s&&(i=s.v,0!=s.e&&s.e<Date.now()&&(function(e,t=o.Storage.Session){switch(t){case o.Storage.Cookie:N(e,"",0,t);break;case o.Storage.Local:window.localStorage.removeItem(e);break;case o.Storage.Session:window.sessionStorage.removeItem(e)}}(e,t),i="")),function(e){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}(i||"")}function N(e,t,n=30,r=o.Storage.Session,i){const s={e:Date.now()+6e4*n,v:String(t)},a=JSON.stringify(s);switch(r){case o.Storage.Cookie:{t="object"==typeof t?JSON.stringify(t):t;let o=`${e}=${encodeURIComponent(t)}; max-age=${60*n}; path=/; SameSite=Lax; secure`;i&&(o+="; domain="+i),document.cookie=o;break}case o.Storage.Local:window.localStorage.setItem(e,a);break;case o.Storage.Session:window.sessionStorage.setItem(e,a)}return I(e,r)}function X(e={}){const t=Date.now(),{length:n=30,deviceKey:o="elbDeviceId",deviceStorage:r="local",deviceAge:i=30,sessionKey:s="elbSessionId",sessionStorage:a="local",pulse:c=!1}=e,u=T(e);let l=!1;const d=S((e,t,n)=>{let o=I(e,n);return o||(o=m(8),N(e,o,1440*t,n)),String(o)})(o,i,r),f=S((e,o)=>{const r=JSON.parse(String(I(e,o)));return c||(r.isNew=!1,u.marketing&&(Object.assign(r,u),l=!0),l||r.updated+6e4*n<t?(delete r.id,delete r.referrer,r.start=t,r.count++,r.runs=1,l=!0):r.runs++),r},()=>{l=!0})(s,a)||{},g={id:m(12),start:t,isNew:!0,count:1,runs:1},p=Object.assign(g,u,f,{device:d},{isStart:l,storage:!0,updated:t},e.data);return N(s,JSON.stringify(p),2*n,a),p}function T(e={}){let t=e.isStart||!1;const n={isStart:t,storage:!1};if(!1===e.isStart)return n;if(!t){const[e]=performance.getEntriesByType("navigation");if("navigate"!==e.type)return n}const o=new URL(e.url||window.location.href),r=e.referrer||document.referrer,s=r&&new URL(r).hostname,a=function(e,t={}){const n="clickId",o={},r={utm_campaign:"campaign",utm_content:"content",utm_medium:"medium",utm_source:"source",utm_term:"term",dclid:n,fbclid:n,gclid:n,msclkid:n,ttclid:n,twclid:n,igshid:n,sclid:n};return Object.entries(i(r,t)).forEach(([t,r])=>{const i=e.searchParams.get(t);i&&(r===n&&(r=t,o[n]=t),o[r]=i)}),o}(o,e.parameters);if(Object.keys(a).length&&(a.marketing||(a.marketing=!0),t=!0),!t){const n=e.domains||[];n.push(o.hostname),t=!n.includes(s)}return t?Object.assign({isStart:t,storage:!1,start:Date.now(),id:m(12),referrer:s},a,e.data):n}var U={Action:"action",Actions:"actions",Config:"config",Consent:"consent",Context:"context",Custom:"custom",Destination:"destination",Elb:"elb",Globals:"globals",Hook:"hook",Init:"init",Link:"link",On:"on",Prefix:"data-elb",Ready:"ready",Run:"run",Session:"session",User:"user",Walker:"walker"},W={type:"code",config:{},init(e){const{config:t,logger:n}=e,o=t.settings,r=null==o?void 0:o.scripts;if(r&&"undefined"!=typeof document)for(const e of r){const t=document.createElement("script");t.src=e,t.async=!0,document.head.appendChild(t)}const i=null==o?void 0:o.init;if(i)try{new Function("context",i)(e)}catch(e){n.error("Code destination init error:",e)}},push(e,t){var n,o;const{mapping:r,config:i,logger:s}=t,a=null!=(o=null==r?void 0:r.push)?o:null==(n=i.settings)?void 0:n.push;if(a)try{new Function("event","context",a)(e,t)}catch(e){s.error("Code destination push error:",e)}},pushBatch(e,t){var n,o;const{mapping:r,config:i,logger:s}=t,a=null!=(o=null==r?void 0:r.pushBatch)?o:null==(n=i.settings)?void 0:n.pushBatch;if(a)try{new Function("batch","context",a)(e,t)}catch(e){s.error("Code destination pushBatch error:",e)}},on(e,t){var n;const{config:o,logger:r}=t,i=null==(n=o.settings)?void 0:n.on;if(i)try{new Function("type","context",i)(e,t)}catch(e){r.error("Code destination on error:",e)}}};function B(e){return!0===e?W:e}async function M(e,t,n){const{allowed:o,consent:r,globals:s,user:a}=e;if(!o)return H({ok:!1});t&&e.queue.push(t),n||(n=e.destinations);const c=await Promise.all(Object.entries(n||{}).map(async([n,o])=>{let c=(o.queue||[]).map(e=>({...e,consent:r}));if(o.queue=[],t){const e=l(t);c.push(e)}if(!c.length)return{id:n,destination:o,skipped:!0};const u=[],d=c.filter(e=>{const t=g(o.config.consent,r,e.consent);return!t||(e.consent=t,u.push(e),!1)});if(o.queue.concat(d),!u.length)return{id:n,destination:o,queue:c};if(!await O(F)(e,o))return{id:n,destination:o,queue:c};let f=!1;return o.dlq||(o.dlq=[]),await Promise.all(u.map(async t=>(t.globals=i(s,t.globals),t.user=i(a,t.user),await O(G,n=>{const r=o.type||"unknown";return e.logger.scope(r).error("Push failed",{error:n,event:t.name}),f=!0,o.dlq.push([t,n]),!1})(e,o,t),t))),{id:n,destination:o,error:f}})),u=[],d=[],f=[];for(const e of c){if(e.skipped)continue;const t=e.destination,n={id:e.id,destination:t};e.error?f.push(n):e.queue&&e.queue.length?(t.queue=(t.queue||[]).concat(e.queue),d.push(n)):u.push(n)}return H({ok:!f.length,event:t,successful:u,queued:d,failed:f})}async function F(e,t){if(t.init&&!t.config.init){const n=t.type||"unknown",o=e.logger.scope(n),r={collector:e,config:t.config,env:K(t.env,t.config.env),logger:o};o.debug("init");const i=await A(t.init,"DestinationInit",e.hooks)(r);if(!1===i)return i;t.config={...i||t.config,init:!0},o.debug("init done")}return!0}async function G(e,t,n){const{config:o}=t,r=await x(n,o,e);if(r.ignore)return!1;const i=t.type||"unknown",s=e.logger.scope(i),c={collector:e,config:o,data:r.data,mapping:r.mapping,env:K(t.env,o.env),logger:s},u=r.mapping,l=r.mappingKey||"* *";if((null==u?void 0:u.batch)&&t.pushBatch){if(t.batches=t.batches||{},!t.batches[l]){const n={key:l,events:[],data:[]};t.batches[l]={batched:n,batchFn:p(()=>{const n=t.batches[l].batched,r={collector:e,config:o,data:void 0,mapping:u,env:K(t.env,o.env),logger:s};s.debug("push batch",{events:n.events.length}),A(t.pushBatch,"DestinationPushBatch",e.hooks)(n,r),s.debug("push batch done"),n.events=[],n.data=[]},u.batch)}}const n=t.batches[l];n.batched.events.push(r.event),a(r.data)&&n.batched.data.push(r.data),n.batchFn()}else s.debug("push",{event:r.event.name}),await A(t.push,"DestinationPush",e.hooks)(r.event,c),s.debug("push done");return!0}function H(e){var t;return i({ok:!(null==(t=null==e?void 0:e.failed)?void 0:t.length),successful:[],queued:[],failed:[]},e)}function K(e,t){return e||t?t?e&&c(e)&&c(t)?{...e,...t}:t:e:{}}function J(e,t,n,o){let r,i=n||[];switch(n||(i=e.on[t]||[]),t){case U.Consent:r=o||e.consent;break;case U.Session:r=e.session;break;case U.Ready:case U.Run:default:r=void 0}if(Object.values(e.sources).forEach(e=>{e.on&&S(e.on)(t,r)}),Object.values(e.destinations).forEach(n=>{if(n.on){const o=n.type||"unknown",i=e.logger.scope(o).scope("on").scope(t),s={collector:e,config:n.config,data:r,env:K(n.env,n.config.env),logger:i};S(n.on)(t,s)}}),i.length)switch(t){case U.Consent:!function(e,t,n){const o=n||e.consent;t.forEach(t=>{Object.keys(o).filter(e=>e in t).forEach(n=>{S(t[n])(e,o)})})}(e,i,o);break;case U.Ready:case U.Run:a=i,(s=e).allowed&&a.forEach(e=>{S(e)(s)});break;case U.Session:!function(e,t){e.session&&t.forEach(t=>{S(t)(e,e.session)})}(e,i)}var s,a}async function z(e,t,n,o){let r;switch(t){case U.Config:c(n)&&i(e.config,n,{shallow:!1});break;case U.Consent:c(n)&&(r=await async function(e,t){const{consent:n}=e;let o=!1;const r={};return Object.entries(t).forEach(([e,t])=>{const n=!!t;r[e]=n,o=o||n}),e.consent=i(n,r),J(e,"consent",void 0,r),o?M(e):H({ok:!0})}(e,n));break;case U.Custom:c(n)&&(e.custom=i(e.custom,n));break;case U.Destination:c(n)&&function(e){return"function"==typeof e}(n.push)&&(r=await async function(e,t,n){const{code:o,config:r={},env:i={}}=t,s=n||r||{init:!1},a=B(o),c={...a,config:s,env:K(a.env,i)};let u=c.config.id;if(!u)do{u=m(4)}while(e.destinations[u]);return e.destinations[u]=c,!1!==c.config.queue&&(c.queue=[...e.queue]),M(e,void 0,{[u]:c})}(e,{code:n},o));break;case U.Globals:c(n)&&(e.globals=i(e.globals,n));break;case U.On:u(n)&&function(e,t,n){const o=e.on,r=o[t]||[],i=s(n)?n:[n];i.forEach(e=>{r.push(e)}),o[t]=r,J(e,t,i)}(e,n,o);break;case U.Ready:J(e,"ready");break;case U.Run:r=await async function(e,t){e.allowed=!0,e.count=0,e.group=m(),e.timing=Date.now(),t&&(t.consent&&(e.consent=i(e.consent,t.consent)),t.user&&(e.user=i(e.user,t.user)),t.globals&&(e.globals=i(e.config.globalsStatic||{},t.globals)),t.custom&&(e.custom=i(e.custom,t.custom))),Object.values(e.destinations).forEach(e=>{e.queue=[]}),e.queue=[],e.round++;const n=await M(e);return J(e,"run"),n}(e,n);break;case U.Session:J(e,"session");break;case U.User:c(n)&&i(e.user,n,{shallow:!1})}return r||{ok:!0,successful:[],queued:[],failed:[]}}function Y(e,t){return A(async(n,o={})=>await O(async()=>{let r=n;if(o.mapping){const t=await x(r,o.mapping,e);if(t.ignore)return H({ok:!0});if(o.mapping.consent&&!g(o.mapping.consent,e.consent,t.event.consent))return H({ok:!0});r=t.event}const i=t(r),s=function(e,t){if(!t.name)throw new Error("Event name is required");const[n,o]=t.name.split(" ");if(!n||!o)throw new Error("Event name is invalid");++e.count;const{timestamp:r=Date.now(),group:i=e.group,count:s=e.count}=t,{name:a=`${n} ${o}`,data:c={},context:u={},globals:l=e.globals,custom:d={},user:f=e.user,nested:g=[],consent:m=e.consent,id:p=`${r}-${i}-${s}`,trigger:h="",entity:y=n,action:b=o,timing:v=0,version:w={source:e.version,tagging:e.config.tagging||0},source:k={type:"collector",id:"",previous_id:""}}=t;return{name:a,data:c,context:u,globals:l,custom:d,user:f,nested:g,consent:m,id:p,trigger:h,entity:y,action:b,timestamp:r,timing:v,group:i,count:s,version:w,source:k}}(e,i);return await M(e,s)},()=>H({ok:!1}))(),"Push",e.hooks)}async function V(e){var t,n;const o=i({globalsStatic:{},sessionStatic:{},tagging:0,run:!0},e,{merge:!1,extend:!1}),r=v({level:null==(t=e.logger)?void 0:t.level,handler:null==(n=e.logger)?void 0:n.handler}),s={...o.globalsStatic,...e.globals},a={allowed:!1,config:o,consent:e.consent||{},count:0,custom:e.custom||{},destinations:{},globals:s,group:"",hooks:{},logger:r,on:{},queue:[],round:0,session:void 0,timing:Date.now(),user:e.user||{},version:"0.6.0",sources:{},push:void 0,command:void 0};return a.push=Y(a,e=>({timing:Math.round((Date.now()-a.timing)/10)/100,source:{type:"collector",id:"",previous_id:""},...e})),a.command=(u=z,A(async(e,t,n)=>await O(async()=>await u(c,e,t,n),()=>H({ok:!1}))(),"Command",(c=a).hooks)),a.destinations=await async function(e,t={}){const n={};for(const[e,o]of Object.entries(t)){const{code:t,config:r={},env:i={}}=o,s=B(t),a={...s.config,...r},c=K(s.env,i);n[e]={...s,config:a,env:c}}return n}(0,e.destinations||{}),a;var c,u}async function Q(e){e=e||{};const t=await V(e),n=(o=t,{type:"elb",config:{},push:async(e,t,n,r,i,s)=>{if("string"==typeof e&&e.startsWith("walker ")){const r=e.replace("walker ","");return o.command(r,t,n)}let a;if("string"==typeof e)a={name:e},t&&"object"==typeof t&&!Array.isArray(t)&&(a.data=t);else{if(!e||"object"!=typeof e)return{ok:!1,successful:[],queued:[],failed:[]};a=e,t&&"object"==typeof t&&!Array.isArray(t)&&(a.data={...a.data||{},...t})}return r&&"object"==typeof r&&(a.context=r),i&&Array.isArray(i)&&(a.nested=i),s&&"object"==typeof s&&(a.custom=s),o.push(a)}});var o;t.sources.elb=n;const r=await async function(e,t={}){const n={};for(const[o,r]of Object.entries(t)){const{code:t,config:i={},env:s={},primary:a}=r,c=(t,n={})=>e.push(t,{...n,mapping:i}),u=e.logger.scope("source").scope(o),l={push:c,command:e.command,sources:e.sources,elb:e.sources.elb.push,logger:u,...s},d=await O(t)(i,l);if(!d)continue;const f=d.type||"unknown",g=e.logger.scope(f).scope(o);l.logger=g,a&&(d.config={...d.config,primary:a}),n[o]=d}return n}(t,e.sources||{});Object.assign(t.sources,r);const{consent:i,user:s,globals:a,custom:c}=e;i&&await t.command("consent",i),s&&await t.command("user",s),a&&Object.assign(t.globals,a),c&&Object.assign(t.custom,c),t.config.run&&await t.command("run");let u=n.push;const l=Object.values(t.sources).filter(e=>"elb"!==e.type),d=l.find(e=>e.config.primary);return d?u=d.push:l.length>0&&(u=l[0].push),{collector:t,elb:u}}var Z,ee=Object.defineProperty,te=(e,t)=>{for(var n in t)ee(e,n,{get:t[n],enumerable:!0})},ne=Object.defineProperty;((e,t)=>{for(var n in t)ne(e,n,{get:t[n],enumerable:!0})})({},{Level:()=>oe});var oe=((Z=oe||{})[Z.ERROR=0]="ERROR",Z[Z.INFO=1]="INFO",Z[Z.DEBUG=2]="DEBUG",Z),re={merge:!0,shallow:!0,extend:!0};function ie(e,t={},n={}){n={...re,...n};const o=Object.entries(t).reduce((t,[o,r])=>{const i=e[o];return n.merge&&Array.isArray(i)&&Array.isArray(r)?t[o]=r.reduce((e,t)=>e.includes(t)?e:[...e,t],[...i]):(n.extend||o in e)&&(t[o]=r),t},{});return n.shallow?{...e,...o}:(Object.assign(e,o),e)}function se(e){return Array.isArray(e)}function ae(e){return e===document||e instanceof Element}function ce(e){return"object"==typeof e&&null!==e&&!se(e)&&"[object Object]"===Object.prototype.toString.call(e)}function ue(e){return"string"==typeof e}function le(e){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}function de(e,t,n){return function(...o){try{return e(...o)}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}}function fe(e){return e?e.trim().replace(/^'|'$/g,"").trim():""}function ge(e,t,n=!0){return e+(null!=t?(n?"-":"")+t:"")}function me(e,t,n,o=!0){return Se(C(t,ge(e,n,o))||"").reduce((e,n)=>{let[o,r]=Oe(n);if(!o)return e;if(r||(o.endsWith(":")&&(o=o.slice(0,-1)),r=""),r.startsWith("#")){r=r.slice(1);try{let e=t[r];e||"selected"!==r||(e=t.options[t.selectedIndex].text),r=String(e)}catch(e){r=""}}return o.endsWith("[]")?(o=o.slice(0,-2),se(e[o])||(e[o]=[]),e[o].push(le(r))):e[o]=le(r),e},{})}function pe(e=U.Prefix,t=document){const n=ge(e,U.Globals,!1);let o={};return Ee(t,`[${n}]`,t=>{o=ie(o,me(e,t,U.Globals,!1))}),o}function he(e,t){const n=window.location,o="page",r=t===document?document.body:t,[i,s]=ke(r,`[${ge(e,o)}]`,e,o);return i.domain=n.hostname,i.title=document.title,i.referrer=document.referrer,n.search&&(i.search=n.search),n.hash&&(i.hash=n.hash),[i,s]}function ye(e){const t={};return Se(e).forEach(e=>{const[n,o]=Oe(e),[r,i]=je(n);if(!r)return;let[s,a]=je(o||"");s=s||r,t[r]||(t[r]=[]),t[r].push({trigger:r,triggerParams:i,action:s,actionParams:a})}),t}function be(e,t,n,o=!1){const r=[];let i=t;for(n=0!==Object.keys(n||{}).length?n:void 0;i;){const s=ve(e,i,t,n);if(s&&(r.push(s),o))break;i=we(e,i)}return r}function ve(e,t,n,o){const r=C(t,ge(e));if(!r||o&&!o[r])return null;const i=[t],s=`[${ge(e,r)}],[${ge(e,"")}]`,a=ge(e,U.Link,!1);let c={};const u=[],[l,d]=ke(n||t,s,e,r);Ee(t,`[${a}]`,t=>{const[n,o]=Oe(C(t,a));"parent"===o&&Ee(document.body,`[${a}="${n}:child"]`,t=>{i.push(t);const n=ve(e,t);n&&u.push(n)})});const f=[];i.forEach(e=>{e.matches(s)&&f.push(e),Ee(e,s,e=>f.push(e))});let g={};return f.forEach(t=>{g=ie(g,me(e,t,"")),c=ie(c,me(e,t,r))}),c=ie(ie(g,c),l),i.forEach(t=>{Ee(t,`[${ge(e)}]`,t=>{const n=ve(e,t);n&&u.push(n)})}),{entity:r,data:c,context:d,nested:u}}function we(e,t){const n=ge(e,U.Link,!1);if(t.matches(`[${n}]`)){const[e,o]=Oe(C(t,n));if("child"===o)return document.querySelector(`[${n}="${e}:parent"]`)}return!t.parentElement&&t.getRootNode&&t.getRootNode()instanceof ShadowRoot?t.getRootNode().host:t.parentElement}function ke(e,t,n,o){let r={};const i={};let s=e;const a=`[${ge(n,U.Context,!1)}]`;let c=0;for(;s;)s.matches(t)&&(r=ie(me(n,s,""),r),r=ie(me(n,s,o),r)),s.matches(a)&&(Object.entries(me(n,s,U.Context,!1)).forEach(([e,t])=>{t&&!i[e]&&(i[e]=[t,c])}),++c),s=we(n,s);return[r,i]}function Ee(e,t,n){e.querySelectorAll(t).forEach(n)}function Se(e,t=";"){if(!e)return[];const n=new RegExp(`(?:[^${t}']+|'[^']*')+`,"ig");return e.match(n)||[]}function Oe(e){const[t,n]=e.split(/:(.+)/,2);return[fe(t),fe(n)]}function je(e){const[t,n]=e.split("(",2);return[t,n?n.slice(0,-1):""]}var _e,xe=new WeakMap,Le=new WeakMap,Ae=new WeakMap;function Ce(e){const t=Date.now();let n=Le.get(e);return(!n||t-n.lastChecked>500)&&(n={isVisible:R(e),lastChecked:t},Le.set(e,n)),n.isVisible}function $e(e){if(window.IntersectionObserver)return de(()=>new window.IntersectionObserver(t=>{t.forEach(t=>{!function(e,t){var n,o;const r=t.target,i=Ae.get(e);if(!i)return;const s=i.timers.get(r);if(t.intersectionRatio>0){const o=Date.now();let a=xe.get(r);if((!a||o-a.lastChecked>1e3)&&(a={isLarge:r.offsetHeight>window.innerHeight,lastChecked:o},xe.set(r,a)),t.intersectionRatio>=.5||a.isLarge&&Ce(r)){const t=null==(n=i.elementConfigs)?void 0:n.get(r);if((null==t?void 0:t.multiple)&&t.blocked)return;if(!s){const t=window.setTimeout(async()=>{var t,n;if(Ce(r)){const o=null==(t=i.elementConfigs)?void 0:t.get(r);(null==o?void 0:o.context)&&await Fe(o.context,r,o.trigger);const s=null==(n=i.elementConfigs)?void 0:n.get(r);(null==s?void 0:s.multiple)?s.blocked=!0:function(e,t){const n=Ae.get(e);if(!n)return;n.observer&&n.observer.unobserve(t);const o=n.timers.get(t);o&&(clearTimeout(o),n.timers.delete(t)),xe.delete(t),Le.delete(t)}(e,r)}},i.duration);i.timers.set(r,t)}return}}s&&(clearTimeout(s),i.timers.delete(r));const a=null==(o=i.elementConfigs)?void 0:o.get(r);(null==a?void 0:a.multiple)&&(a.blocked=!1)}(e,t)})},{rootMargin:"0px",threshold:[0,.5]}),()=>{})()}function qe(e,t,n={multiple:!1}){var o;const r=e.settings.scope||document,i=Ae.get(r);(null==i?void 0:i.observer)&&t&&(i.elementConfigs||(i.elementConfigs=new WeakMap),i.elementConfigs.set(t,{multiple:null!=(o=n.multiple)&&o,blocked:!1,context:e,trigger:n.multiple?"visible":"impression"}),i.observer.observe(t))}function Re(e){if(!e)return;const t=Ae.get(e);t&&(t.observer&&t.observer.disconnect(),Ae.delete(e))}function Pe(e,t,n,o,r,i,s){const{elb:a,settings:c}=e;if(ue(t)&&t.startsWith("walker "))return a(t,n);if(ce(t)){const e=t;return e.source||(e.source=De()),e.globals||(e.globals=pe(c.prefix,c.scope||document)),a(e)}const[u]=String(ce(t)?t.name:t).split(" ");let l,d=ce(n)?n:{},f={},g=!1;if(ae(n)&&(l=n,g=!0),ae(r)?l=r:ce(r)&&Object.keys(r).length&&(f=r),l){const e=be(c.prefix||"data-elb",l).find(e=>e.entity===u);e&&(g&&(d=e.data),f=e.context)}"page"===u&&(d.id=d.id||window.location.pathname);const m=pe(c.prefix,c.scope);return a({name:String(t||""),data:d,context:f,globals:m,nested:i,custom:s,trigger:ue(o)?o:"",source:De()})}function De(){return{type:"browser",id:window.location.href,previous_id:document.referrer}}var Ie=[],Ne="hover",Xe="load",Te="pulse",Ue="scroll",We="wait";function Be(e,t){t.scope&&function(e,t){const n=t.scope;n&&(n.addEventListener("click",de(function(t){He.call(this,e,t)})),n.addEventListener("submit",de(function(t){Ke.call(this,e,t)})))}(e,t)}function Me(e,t){t.scope&&function(e,t){const n=t.scope;Ie=[];const o=n||document;Re(o),function(e,t=1e3){Ae.has(e)||Ae.set(e,{observer:$e(e),timers:new WeakMap,duration:t})}(o,1e3);const r=ge(t.prefix,U.Action,!1);o!==document&&Ge(e,o,r,t),o.querySelectorAll(`[${r}]`).forEach(n=>{Ge(e,n,r,t)}),Ie.length&&function(e,t){const n=(e,t)=>e.filter(([e,n])=>{const o=window.scrollY+window.innerHeight,r=e.offsetTop;if(o<r)return!0;const i=e.clientHeight;return!(100*(1-(r+i-o)/(i||1))>=n&&(Fe(t,e,Ue),1))});_e||(_e=function(e,t=1e3){let n=null;return function(...o){if(null===n)return n=setTimeout(()=>{n=null},t),e(...o)}}(function(){Ie=n.call(t,Ie,e)}),t.addEventListener("scroll",_e))}(e,o)}(e,t)}async function Fe(e,t,n){const o=function(e,t,n=U.Prefix){const o=[],{actions:r,nearestOnly:i}=function(e,t,n){let o=t;for(;o;){const t=C(o,ge(e,U.Actions,!1));if(t){const e=ye(t);if(e[n])return{actions:e[n],nearestOnly:!1}}const r=C(o,ge(e,U.Action,!1));if(r){const e=ye(r);if(e[n]||"click"!==n)return{actions:e[n]||[],nearestOnly:!0}}o=we(e,o)}return{actions:[],nearestOnly:!1}}(n,e,t);return r.length?(r.forEach(r=>{const s=Se(r.actionParams||"",",").reduce((e,t)=>(e[fe(t)]=!0,e),{}),a=be(n,e,s,i);if(!a.length){const t="page",o=`[${ge(n,t)}]`,[r,i]=ke(e,o,n,t);a.push({entity:t,data:r,nested:[],context:i})}a.forEach(e=>{o.push({entity:e.entity,action:r.action,data:e.data,trigger:t,context:e.context,nested:e.nested})})}),o):o}(t,n,e.settings.prefix);return Promise.all(o.map(t=>Pe(e,{name:`${t.entity} ${t.action}`,...t,trigger:n})))}function Ge(e,t,n,o){const r=C(t,n);r&&Object.values(ye(r)).forEach(n=>n.forEach(n=>{switch(n.trigger){case Ne:o=e,t.addEventListener("mouseenter",de(function(e){e.target instanceof Element&&Fe(o,e.target,Ne)}));break;case Xe:!function(e,t){Fe(e,t,Xe)}(e,t);break;case Te:!function(e,t,n=""){setInterval(()=>{document.hidden||Fe(e,t,Te)},parseInt(n||"")||15e3)}(e,t,n.triggerParams);break;case Ue:!function(e,t=""){const n=parseInt(t||"")||50;n<0||n>100||Ie.push([e,n])}(t,n.triggerParams);break;case"impression":qe(e,t);break;case"visible":qe(e,t,{multiple:!0});break;case We:!function(e,t,n=""){setTimeout(()=>Fe(e,t,We),parseInt(n||"")||15e3)}(e,t,n.triggerParams)}var o}))}function He(e,t){Fe(e,t.target,"click")}function Ke(e,t){t.target&&Fe(e,t.target,"submit")}function Je(e,t,n,o){const r=[];let i=!0;n.forEach(e=>{const t=Ye(e)?[...Array.from(e)]:null!=(n=e)&&"object"==typeof n&&"length"in n&&"number"==typeof n.length?Array.from(e):[e];var n;if(Array.isArray(t)&&0===t.length)return;if(Array.isArray(t)&&1===t.length&&!t[0])return;const s=t[0],a=!ce(s)&&ue(s)&&s.startsWith("walker ");if(ce(s)){if("object"==typeof s&&0===Object.keys(s).length)return}else{const e=Array.from(t);if(!ue(e[0])||""===e[0].trim())return;const n="walker run";i&&e[0]===n&&(i=!1)}(o&&a||!o&&!a)&&r.push(t)}),r.forEach(n=>{ze(e,t,n)})}function ze(e,t="data-elb",n){de(()=>{if(Array.isArray(n)){const[o,...r]=n;if(!o||ue(o)&&""===o.trim())return;if(ue(o)&&o.startsWith("walker "))return void e(o,r[0]);Pe({elb:e,settings:{prefix:t,scope:document,pageview:!1,session:!1,elb:"",elbLayer:!1}},o,...r)}else if(n&&"object"==typeof n){if(0===Object.keys(n).length)return;e(n)}},()=>{})()}function Ye(e){return null!=e&&"object"==typeof e&&"[object Arguments]"===Object.prototype.toString.call(e)}function Ve(e,t={},n){return function(e={}){const{cb:t,consent:n,collector:o,storage:r}=e;if(!n)return P((r?X:T)(e),o,t);{const r=function(e,t){let n;return(o,r)=>{if(a(n)&&n===(null==o?void 0:o.group))return;n=null==o?void 0:o.group;let i=()=>T(e);return e.consent&&g((s(e.consent)?e.consent:[e.consent]).reduce((e,t)=>({...e,[t]:!0}),{}),r)&&(i=()=>X(e)),P(i(),o,t)}}(e,t),i=(s(n)?n:[n]).reduce((e,t)=>({...e,[t]:r}),{});o?o.command("on","consent",i):q("walker on","consent",i)}}({...t,collector:{push:e,group:void 0,command:n}})}te({},{env:()=>Qe});var Qe={};te(Qe,{push:()=>nt});var Ze=()=>{},et=()=>()=>Promise.resolve({ok:!0,successful:[],queued:[],failed:[]}),tt={error:Ze,info:Ze,debug:Ze,throw:e=>{throw"string"==typeof e?new Error(e):e},scope:()=>tt},nt={get push(){return et()},get command(){return et()},get elb(){return et()},get window(){return{addEventListener:Ze,removeEventListener:Ze,location:{href:"https://example.com/page",pathname:"/page",search:"?query=test",hash:"#section",host:"example.com",hostname:"example.com",origin:"https://example.com",protocol:"https:"},document:{},navigator:{language:"en-US",userAgent:"Mozilla/5.0 (Test)"},screen:{width:1920,height:1080},innerWidth:1920,innerHeight:1080,pageXOffset:0,pageYOffset:0,scrollX:0,scrollY:0}},get document(){return{addEventListener:Ze,removeEventListener:Ze,querySelector:Ze,querySelectorAll:()=>[],getElementById:Ze,getElementsByClassName:()=>[],getElementsByTagName:()=>[],createElement:()=>({setAttribute:Ze,getAttribute:Ze,addEventListener:Ze,removeEventListener:Ze}),body:{appendChild:Ze,removeChild:Ze},documentElement:{scrollTop:0,scrollLeft:0},readyState:"complete",title:"Test Page",referrer:"",cookie:""}},logger:tt},ot=async(e,t)=>{const{elb:n,command:o,window:r,document:i}=t,s=(null==e?void 0:e.settings)||{},a=r||(void 0!==globalThis.window?globalThis.window:void 0),c=i||(void 0!==globalThis.document?globalThis.document:void 0),u=function(e={},t){return{prefix:"data-elb",pageview:!0,session:!0,elb:"elb",elbLayer:"elbLayer",scope:t||void 0,...e}}(s,c),l={settings:u},d={elb:n,settings:u};if(a&&c){if(!1!==u.elbLayer&&n&&function(e,t={}){const n=t.name||"elbLayer",o=t.window||window;if(!o)return;const r=o;r[n]||(r[n]=[]);const i=r[n];i.push=function(...n){if(Ye(n[0])){const o=[...Array.from(n[0])],r=Array.prototype.push.apply(this,[o]);return ze(e,t.prefix,o),r}const o=Array.prototype.push.apply(this,n);return n.forEach(n=>{ze(e,t.prefix,n)}),o},Array.isArray(i)&&i.length>0&&function(e,t="data-elb",n){Je(e,t,n,!0),Je(e,t,n,!1),n.length=0}(e,t.prefix,i)}(n,{name:ue(u.elbLayer)?u.elbLayer:"elbLayer",prefix:u.prefix,window:a}),u.session&&n){const e="boolean"==typeof u.session?{}:u.session;Ve(n,e,o)}await async function(e,t,n){const o=()=>{e(t,n)};"loading"!==document.readyState?o():document.addEventListener("DOMContentLoaded",o)}(Be,d,u),(()=>{if(Me(d,u),u.pageview){const[e,t]=he(u.prefix||"data-elb",u.scope);Pe(d,"page view",e,"load",t)}})(),ue(u.elb)&&u.elb&&(a[u.elb]=(...e)=>{const[t,n,o,r,i,s]=e;return Pe(d,t,n,o,r,i,s)})}return{type:"browser",config:l,push:(...e)=>{const[t,n,o,r,i,s]=e;return Pe(d,t,n,o,r,i,s)},destroy:async()=>{c&&Re(u.scope||c)},on:async(e,t)=>{switch(e){case"consent":if(u.session&&t&&n){const e="boolean"==typeof u.session?{}:u.session;Ve(n,e,o)}break;case"session":case"ready":default:break;case"run":if(c&&a&&(Me(d,u),u.pageview)){const[e,t]=he(u.prefix||"data-elb",u.scope);Pe(d,"page view",e,"load",t)}}}}},rt=Object.defineProperty,it=(e,t)=>{for(var n in t)rt(e,n,{get:t[n],enumerable:!0})},st=!1;function at(e,t={},n){if(t.filter&&!0===S(()=>t.filter(n),()=>!1)())return;const o=function(e){if(c(e)&&u(e.event)){const{event:t,...n}=e;return{name:t,...n}}return s(e)&&e.length>=2?ct(e):null!=(t=e)&&"object"==typeof t&&"length"in t&&"number"==typeof t.length&&t.length>0?ct(Array.from(e)):null;var t}(n);if(!o)return;const r=`${t.prefix||"dataLayer"} ${o.name}`,{name:i,...a}=o,l={name:r,data:a};S(()=>e(l),()=>{})()}function ct(e){const[t,n,o]=e;if(!u(t))return null;let r,i={};switch(t){case"consent":if(!u(n)||e.length<3)return null;if("default"!==n&&"update"!==n)return null;if(!c(o)||null===o)return null;r=`${t} ${n}`,i={...o};break;case"event":if(!u(n))return null;r=n,c(o)&&(i={...o});break;case"config":if(!u(n))return null;r=`${t} ${n}`,c(o)&&(i={...o});break;case"set":if(u(n))r=`${t} ${n}`,c(o)&&(i={...o});else{if(!c(n))return null;r=`${t} custom`,i={...n}}break;default:return null}return{name:r,...i}}it({},{push:()=>ft});var ut=()=>{},lt=()=>()=>Promise.resolve({ok:!0,successful:[],queued:[],failed:[]}),dt={error:ut,info:ut,debug:ut,throw:e=>{throw"string"==typeof e?new Error(e):e},scope:()=>dt},ft={get push(){return lt()},get command(){return lt()},get elb(){return lt()},get window(){return{dataLayer:[],addEventListener:ut,removeEventListener:ut}},logger:dt};function gt(){return["consent","update",{ad_user_data:"granted",ad_personalization:"granted",ad_storage:"denied",analytics_storage:"granted"}]}function mt(){return["consent","default",{ad_storage:"denied",analytics_storage:"denied",ad_user_data:"denied",ad_personalization:"denied"}]}function pt(){return["event","purchase",{transaction_id:"T_12345",value:25.42,currency:"EUR",items:[{item_id:"SKU_12345",item_name:"Product Name",item_category:"Category",quantity:1,price:25.42}]}]}function ht(){return["event","add_to_cart",{currency:"EUR",value:15.25,items:[{item_id:"SKU_12345",item_name:"Product Name",item_variant:"red",quantity:1,price:15.25}]}]}function yt(){return["event","view_item",{currency:"EUR",value:15.25,items:[{item_id:"SKU_12345",item_name:"Product Name",item_category:"Category",price:15.25}]}]}function bt(){return["config","G-XXXXXXXXXX",{page_title:"Custom Page Title",page_location:"https://example.com/page",send_page_view:!1}]}function vt(){return["set",{currency:"EUR",country:"DE"}]}function wt(){return{event:"custom_event",custom_parameter:"custom_value",user_id:"user123"}}it({},{add_to_cart:()=>ht,config:()=>bt,consentDefault:()=>mt,consentUpdate:()=>gt,directDataLayerEvent:()=>wt,purchase:()=>pt,setCustom:()=>vt,view_item:()=>yt});it({},{add_to_cart:()=>St,config:()=>xt,configGA4:()=>jt,consentOnlyMapping:()=>Lt,consentUpdate:()=>kt,customEvent:()=>_t,purchase:()=>Et,view_item:()=>Ot});var kt={name:"walker consent",settings:{command:{map:{functional:{value:!0},analytics:{key:"analytics_storage",fn:e=>"granted"===e},marketing:{key:"ad_storage",fn:e=>"granted"===e}}}}},Et={name:"order complete",data:{map:{id:"transaction_id",total:"value",currency:"currency",nested:{loop:["items",{map:{type:{value:"product"},data:{map:{id:"item_id",name:"item_name",category:"item_category",quantity:"quantity",price:"price"}}}}]}}}},St={name:"product add",data:{map:{id:"items.0.item_id",name:"items.0.item_name",price:"value",currency:"currency",color:"items.0.item_variant",quantity:"items.0.quantity"}}},Ot={name:"product view",data:{map:{id:"items.0.item_id",name:"items.0.item_name",category:"items.0.item_category",price:"items.0.price",currency:"currency"}}},jt={name:"page view",data:{map:{title:"page_title",url:"page_location"}}},_t={data:{map:{user_id:"user_id",custom_parameter:"custom_parameter"}}},xt={consent:{update:kt},purchase:Et,add_to_cart:St,view_item:Ot,"config G-XXXXXXXXXX":jt,custom_event:_t,"*":{data:{}}},Lt={consent:{update:kt}},At=async(e,t)=>{const{elb:n,window:o}=t,r={name:"dataLayer",prefix:"dataLayer",...null==e?void 0:e.settings},i={settings:r};return o&&(function(e,t){const n=t.settings,o=(null==n?void 0:n.name)||"dataLayer",r=window[o];if(Array.isArray(r)&&!st){st=!0;try{for(const t of r)at(e,n,t)}finally{st=!1}}}(n,i),function(e,t){const n=t.settings,o=(null==n?void 0:n.name)||"dataLayer";window[o]||(window[o]=[]);const r=window[o];if(!Array.isArray(r))return;const i=r.push.bind(r);r.push=function(...t){if(st)return i(...t);st=!0;try{for(const o of t)at(e,n,o)}finally{st=!1}return i(...t)}}(n,i)),{type:"dataLayer",config:i,push:n,destroy:async()=>{const e=r.name||"dataLayer";o&&o[e]&&Array.isArray(o[e])}}};function Ct(){window.dataLayer=window.dataLayer||[];const e=e=>{c(e)&&c(e.source)&&String(e.source.type).includes("dataLayer")||window.dataLayer.push(e)};return{type:"dataLayer",config:{},push:(t,n)=>{e(n.data||t)},pushBatch:t=>{e({name:"batch",batched_event:t.key,events:t.data.length?t.data:t.events})}}}if(window&&document){const e=async()=>{let e;const t=document.querySelector("script[data-elbconfig]");if(t){const n=t.getAttribute("data-elbconfig")||"";n.includes(":")?e=$(n):n&&(e=window[n])}e||(e=window.elbConfig),e&&await async function(e={}){const t=i({collector:{destinations:{dataLayer:{code:Ct()}}},browser:{session:!0},dataLayer:!1,elb:"elb",run:!0},e),n={...t.collector,sources:{browser:{code:ot,config:{settings:t.browser},env:{window:"undefined"!=typeof window?window:void 0,document:"undefined"!=typeof document?document:void 0}}}};if(t.dataLayer){const e=c(t.dataLayer)?t.dataLayer:{};n.sources&&(n.sources.dataLayer={code:At,config:{settings:e}})}const o=await Q(n);return"undefined"!=typeof window&&(t.elb&&(window[t.elb]=o.elb),t.name&&(window[t.name]=o.collector)),o}(e)};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e()}})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"walkerjs.d.ts","sourceRoot":"","sources":["../src/walkerjs.ts"],"names":[],"mappings":""}
|
package/dist/walkerjs.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { parseInlineConfig } from '@walkeros/web-core';
|
|
2
|
+
import { createWalkerjs } from './index';
|
|
3
|
+
if (window && document) {
|
|
4
|
+
const initializeWalker = async () => {
|
|
5
|
+
let globalConfig;
|
|
6
|
+
// Check for config from script tag
|
|
7
|
+
const scriptElement = document.querySelector('script[data-elbconfig]');
|
|
8
|
+
if (scriptElement) {
|
|
9
|
+
const configValue = scriptElement.getAttribute('data-elbconfig') || '';
|
|
10
|
+
if (configValue.includes(':')) {
|
|
11
|
+
// Inline config: "elb:track;run:false;instance:myWalker"
|
|
12
|
+
globalConfig = parseInlineConfig(configValue);
|
|
13
|
+
}
|
|
14
|
+
else if (configValue) {
|
|
15
|
+
// Named config: "myWalkerConfig"
|
|
16
|
+
globalConfig = window[configValue];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
// Fallback to window.elbConfig
|
|
20
|
+
if (!globalConfig)
|
|
21
|
+
globalConfig = window.elbConfig;
|
|
22
|
+
// Auto-initialize if config is found
|
|
23
|
+
if (globalConfig) {
|
|
24
|
+
await createWalkerjs(globalConfig);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
// Initialize immediately if DOM is ready, otherwise wait for DOM ready
|
|
28
|
+
if (document.readyState === 'loading') {
|
|
29
|
+
document.addEventListener('DOMContentLoaded', initializeWalker);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
initializeWalker();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=walkerjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"walkerjs.js","sourceRoot":"","sources":["../src/walkerjs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC,IAAI,MAAM,IAAI,QAAQ,EAAE,CAAC;IACvB,MAAM,gBAAgB,GAAG,KAAK,IAAI,EAAE;QAClC,IAAI,YAAgC,CAAC;QAErC,mCAAmC;QACnC,MAAM,aAAa,GAAG,QAAQ,CAAC,aAAa,CAAC,wBAAwB,CAAC,CAAC;QACvE,IAAI,aAAa,EAAE,CAAC;YAClB,MAAM,WAAW,GAAG,aAAa,CAAC,YAAY,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC;YAEvE,IAAI,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC9B,yDAAyD;gBACzD,YAAY,GAAG,iBAAiB,CAAC,WAAW,CAAW,CAAC;YAC1D,CAAC;iBAAM,IAAI,WAAW,EAAE,CAAC;gBACvB,iCAAiC;gBACjC,YAAY,GAAG,MAAM,CAAC,WAAW,CAAW,CAAC;YAC/C,CAAC;QACH,CAAC;QAED,+BAA+B;QAC/B,IAAI,CAAC,YAAY;YAAE,YAAY,GAAG,MAAM,CAAC,SAAmB,CAAC;QAE7D,qCAAqC;QACrC,IAAI,YAAY,EAAE,CAAC;YACjB,MAAM,cAAc,CAAC,YAAY,CAAC,CAAC;QACrC,CAAC;IACH,CAAC,CAAC;IAEF,uEAAuE;IACvE,IAAI,QAAQ,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QACtC,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAC;IAClE,CAAC;SAAM,CAAC;QACN,gBAAgB,EAAE,CAAC;IACrB,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@walkeros/walker.js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Ready-to-use walkerOS bundle with browser source, collector, and dataLayer support",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"preview": "npm run build && npx serve -l 3333 examples"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@walkeros/core": "0.
|
|
42
|
-
"@walkeros/collector": "0.
|
|
43
|
-
"@walkeros/web-core": "0.
|
|
44
|
-
"@walkeros/web-source-browser": "0.
|
|
45
|
-
"@walkeros/web-source-datalayer": "0.
|
|
41
|
+
"@walkeros/core": "0.6.0",
|
|
42
|
+
"@walkeros/collector": "0.6.0",
|
|
43
|
+
"@walkeros/web-core": "0.6.0",
|
|
44
|
+
"@walkeros/web-source-browser": "0.6.0",
|
|
45
|
+
"@walkeros/web-source-datalayer": "0.6.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@swc/jest": "^0.2.39",
|