@walkeros/core 1.2.2 → 1.3.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/dist/index.d.mts CHANGED
@@ -44,6 +44,25 @@ interface SessionData extends Properties {
44
44
  count?: number;
45
45
  runs?: number;
46
46
  }
47
+ interface Status {
48
+ startedAt: number;
49
+ in: number;
50
+ out: number;
51
+ failed: number;
52
+ sources: Record<string, SourceStatus>;
53
+ destinations: Record<string, DestinationStatus>;
54
+ }
55
+ interface SourceStatus {
56
+ count: number;
57
+ lastAt?: number;
58
+ duration: number;
59
+ }
60
+ interface DestinationStatus {
61
+ count: number;
62
+ failed: number;
63
+ lastAt?: number;
64
+ duration: number;
65
+ }
47
66
  interface Sources {
48
67
  [id: string]: Instance;
49
68
  }
@@ -107,19 +126,27 @@ interface Instance$4 {
107
126
  queue: Events;
108
127
  round: number;
109
128
  session: undefined | SessionData;
129
+ status: Status;
110
130
  timing: number;
111
131
  user: User;
112
132
  version: string;
133
+ pending: {
134
+ sources: InitSources;
135
+ destinations: InitDestinations;
136
+ };
113
137
  }
114
138
 
115
139
  type collector_CommandFn = CommandFn;
116
140
  type collector_CommandType = CommandType;
141
+ type collector_DestinationStatus = DestinationStatus;
117
142
  type collector_InitConfig = InitConfig;
118
143
  type collector_PushOptions = PushOptions;
119
144
  type collector_SessionData = SessionData;
145
+ type collector_SourceStatus = SourceStatus;
120
146
  type collector_Sources = Sources;
147
+ type collector_Status = Status;
121
148
  declare namespace collector {
122
- export type { collector_CommandFn as CommandFn, collector_CommandType as CommandType, Config$7 as Config, Destinations$1 as Destinations, collector_InitConfig as InitConfig, Instance$4 as Instance, PushFn$1 as PushFn, collector_PushOptions as PushOptions, collector_SessionData as SessionData, collector_Sources as Sources, Transformers$1 as Transformers };
149
+ export type { collector_CommandFn as CommandFn, collector_CommandType as CommandType, Config$7 as Config, collector_DestinationStatus as DestinationStatus, Destinations$1 as Destinations, collector_InitConfig as InitConfig, Instance$4 as Instance, PushFn$1 as PushFn, collector_PushOptions as PushOptions, collector_SessionData as SessionData, collector_SourceStatus as SourceStatus, collector_Sources as Sources, collector_Status as Status, Transformers$1 as Transformers };
123
150
  }
124
151
 
125
152
  /**
@@ -262,6 +289,7 @@ interface Config$6<T extends TypesGeneric$2 = Types$3> {
262
289
  mapping?: Rules<Rule<Mapping$1<T>>>;
263
290
  policy?: Policy$1;
264
291
  queue?: boolean;
292
+ require?: string[];
265
293
  before?: string | string[];
266
294
  }
267
295
  type PartialConfig$1<T extends TypesGeneric$2 = Types$3> = Config$6<Types$3<Partial<Settings$2<T>> | Settings$2<T>, Partial<Mapping$1<T>> | Mapping$1<T>, Env$2<T>>>;
@@ -1192,41 +1220,57 @@ declare namespace mapping {
1192
1220
  }
1193
1221
 
1194
1222
  type Config$2 = {
1223
+ config?: Array<GenericConfig>;
1195
1224
  consent?: Array<ConsentConfig>;
1225
+ custom?: Array<GenericConfig>;
1226
+ globals?: Array<GenericConfig>;
1196
1227
  ready?: Array<ReadyConfig>;
1197
1228
  run?: Array<RunConfig>;
1198
1229
  session?: Array<SessionConfig>;
1230
+ user?: Array<UserConfig>;
1199
1231
  };
1200
- type Types$2 = keyof Config$2;
1232
+ type Types$2 = keyof Config$2 | (string & {});
1201
1233
  interface EventContextMap {
1234
+ config: Partial<Config$7>;
1202
1235
  consent: Consent;
1203
- session: SessionData;
1236
+ custom: Properties;
1237
+ globals: Properties;
1204
1238
  ready: undefined;
1205
1239
  run: undefined;
1240
+ session: SessionData;
1241
+ user: User;
1206
1242
  }
1207
- type EventContext<T extends Types$2> = EventContextMap[T];
1243
+ type EventContext<T extends keyof EventContextMap> = EventContextMap[T];
1208
1244
  type AnyEventContext = EventContextMap[keyof EventContextMap];
1209
1245
  interface Context$3 {
1210
1246
  consent?: Consent;
1211
1247
  session?: unknown;
1212
1248
  }
1213
- type Options = ConsentConfig | ReadyConfig | RunConfig | SessionConfig;
1249
+ type Options = ConsentConfig | GenericConfig | ReadyConfig | RunConfig | SessionConfig | UserConfig;
1214
1250
  interface ConsentConfig {
1215
1251
  [key: string]: ConsentFn;
1216
1252
  }
1217
1253
  type ConsentFn = (collector: Instance$4, consent: Consent) => void;
1254
+ type GenericConfig = GenericFn;
1255
+ type GenericFn = (collector: Instance$4, data: unknown) => void;
1218
1256
  type ReadyConfig = ReadyFn;
1219
1257
  type ReadyFn = (collector: Instance$4) => void;
1220
1258
  type RunConfig = RunFn;
1221
1259
  type RunFn = (collector: Instance$4) => void;
1222
1260
  type SessionConfig = SessionFn;
1223
1261
  type SessionFn = (collector: Instance$4, session?: unknown) => void;
1262
+ type UserConfig = UserFn;
1263
+ type UserFn = (collector: Instance$4, user: User) => void;
1224
1264
  interface OnConfig {
1265
+ config?: GenericConfig[];
1225
1266
  consent?: ConsentConfig[];
1267
+ custom?: GenericConfig[];
1268
+ globals?: GenericConfig[];
1226
1269
  ready?: ReadyConfig[];
1227
1270
  run?: RunConfig[];
1228
1271
  session?: SessionConfig[];
1229
- [key: string]: ConsentConfig[] | ReadyConfig[] | RunConfig[] | SessionConfig[] | undefined;
1272
+ user?: UserConfig[];
1273
+ [key: string]: ConsentConfig[] | GenericConfig[] | ReadyConfig[] | RunConfig[] | SessionConfig[] | UserConfig[] | undefined;
1230
1274
  }
1231
1275
  type OnFn<T extends TypesGeneric$2 = Types$3> = (type: Types$2, context: Context$4<T>) => PromiseOrValue<void>;
1232
1276
  type OnFnRuntime = (type: Types$2, context: Context$4) => PromiseOrValue<void>;
@@ -1234,8 +1278,10 @@ type OnFnRuntime = (type: Types$2, context: Context$4) => PromiseOrValue<void>;
1234
1278
  type on_AnyEventContext = AnyEventContext;
1235
1279
  type on_ConsentConfig = ConsentConfig;
1236
1280
  type on_ConsentFn = ConsentFn;
1237
- type on_EventContext<T extends Types$2> = EventContext<T>;
1281
+ type on_EventContext<T extends keyof EventContextMap> = EventContext<T>;
1238
1282
  type on_EventContextMap = EventContextMap;
1283
+ type on_GenericConfig = GenericConfig;
1284
+ type on_GenericFn = GenericFn;
1239
1285
  type on_OnConfig = OnConfig;
1240
1286
  type on_OnFn<T extends TypesGeneric$2 = Types$3> = OnFn<T>;
1241
1287
  type on_OnFnRuntime = OnFnRuntime;
@@ -1246,8 +1292,10 @@ type on_RunConfig = RunConfig;
1246
1292
  type on_RunFn = RunFn;
1247
1293
  type on_SessionConfig = SessionConfig;
1248
1294
  type on_SessionFn = SessionFn;
1295
+ type on_UserConfig = UserConfig;
1296
+ type on_UserFn = UserFn;
1249
1297
  declare namespace on {
1250
- export type { on_AnyEventContext as AnyEventContext, Config$2 as Config, on_ConsentConfig as ConsentConfig, on_ConsentFn as ConsentFn, Context$3 as Context, on_EventContext as EventContext, on_EventContextMap as EventContextMap, on_OnConfig as OnConfig, on_OnFn as OnFn, on_OnFnRuntime as OnFnRuntime, on_Options as Options, on_ReadyConfig as ReadyConfig, on_ReadyFn as ReadyFn, on_RunConfig as RunConfig, on_RunFn as RunFn, on_SessionConfig as SessionConfig, on_SessionFn as SessionFn, Types$2 as Types };
1298
+ export type { on_AnyEventContext as AnyEventContext, Config$2 as Config, on_ConsentConfig as ConsentConfig, on_ConsentFn as ConsentFn, Context$3 as Context, on_EventContext as EventContext, on_EventContextMap as EventContextMap, on_GenericConfig as GenericConfig, on_GenericFn as GenericFn, on_OnConfig as OnConfig, on_OnFn as OnFn, on_OnFnRuntime as OnFnRuntime, on_Options as Options, on_ReadyConfig as ReadyConfig, on_ReadyFn as ReadyFn, on_RunConfig as RunConfig, on_RunFn as RunFn, on_SessionConfig as SessionConfig, on_SessionFn as SessionFn, Types$2 as Types, on_UserConfig as UserConfig, on_UserFn as UserFn };
1251
1299
  }
1252
1300
 
1253
1301
  /**
@@ -1299,7 +1347,7 @@ interface Config$1<T extends TypesGeneric$1 = Types$1> {
1299
1347
  env?: Env$1<T>;
1300
1348
  id?: string;
1301
1349
  logger?: Config$4;
1302
- next?: string;
1350
+ next?: string | string[];
1303
1351
  init?: boolean;
1304
1352
  }
1305
1353
  /**
@@ -1354,6 +1402,7 @@ type InitTransformer<T extends TypesGeneric$1 = Types$1> = {
1354
1402
  code: Init$1<T>;
1355
1403
  config?: Partial<Config$1<T>>;
1356
1404
  env?: Partial<Env$1<T>>;
1405
+ next?: string | string[];
1357
1406
  };
1358
1407
  /**
1359
1408
  * Transformers configuration for collector.
@@ -1483,6 +1532,7 @@ interface Config<T extends TypesGeneric = Types> extends Config$3<Mapping<T>> {
1483
1532
  logger?: Config$4;
1484
1533
  disabled?: boolean;
1485
1534
  primary?: boolean;
1535
+ require?: string[];
1486
1536
  /**
1487
1537
  * Ingest metadata extraction mapping.
1488
1538
  * Extracts values from raw request objects (Express req, Lambda event, etc.)
@@ -1503,7 +1553,7 @@ interface Instance<T extends TypesGeneric = Types> {
1503
1553
  config: Config<T>;
1504
1554
  push: Push<T>;
1505
1555
  destroy?(): void | Promise<void>;
1506
- on?(event: Types$2, context?: unknown): void | Promise<void>;
1556
+ on?(event: Types$2, context?: unknown): void | boolean | Promise<void | boolean>;
1507
1557
  }
1508
1558
  /**
1509
1559
  * Context provided to source init function.
@@ -1526,7 +1576,7 @@ type InitSource<T extends TypesGeneric = Types> = {
1526
1576
  config?: Partial<Config<T>>;
1527
1577
  env?: Partial<Env<T>>;
1528
1578
  primary?: boolean;
1529
- next?: string;
1579
+ next?: string | string[];
1530
1580
  };
1531
1581
  /**
1532
1582
  * Sources configuration for collector.
package/dist/index.d.ts CHANGED
@@ -44,6 +44,25 @@ interface SessionData extends Properties {
44
44
  count?: number;
45
45
  runs?: number;
46
46
  }
47
+ interface Status {
48
+ startedAt: number;
49
+ in: number;
50
+ out: number;
51
+ failed: number;
52
+ sources: Record<string, SourceStatus>;
53
+ destinations: Record<string, DestinationStatus>;
54
+ }
55
+ interface SourceStatus {
56
+ count: number;
57
+ lastAt?: number;
58
+ duration: number;
59
+ }
60
+ interface DestinationStatus {
61
+ count: number;
62
+ failed: number;
63
+ lastAt?: number;
64
+ duration: number;
65
+ }
47
66
  interface Sources {
48
67
  [id: string]: Instance;
49
68
  }
@@ -107,19 +126,27 @@ interface Instance$4 {
107
126
  queue: Events;
108
127
  round: number;
109
128
  session: undefined | SessionData;
129
+ status: Status;
110
130
  timing: number;
111
131
  user: User;
112
132
  version: string;
133
+ pending: {
134
+ sources: InitSources;
135
+ destinations: InitDestinations;
136
+ };
113
137
  }
114
138
 
115
139
  type collector_CommandFn = CommandFn;
116
140
  type collector_CommandType = CommandType;
141
+ type collector_DestinationStatus = DestinationStatus;
117
142
  type collector_InitConfig = InitConfig;
118
143
  type collector_PushOptions = PushOptions;
119
144
  type collector_SessionData = SessionData;
145
+ type collector_SourceStatus = SourceStatus;
120
146
  type collector_Sources = Sources;
147
+ type collector_Status = Status;
121
148
  declare namespace collector {
122
- export type { collector_CommandFn as CommandFn, collector_CommandType as CommandType, Config$7 as Config, Destinations$1 as Destinations, collector_InitConfig as InitConfig, Instance$4 as Instance, PushFn$1 as PushFn, collector_PushOptions as PushOptions, collector_SessionData as SessionData, collector_Sources as Sources, Transformers$1 as Transformers };
149
+ export type { collector_CommandFn as CommandFn, collector_CommandType as CommandType, Config$7 as Config, collector_DestinationStatus as DestinationStatus, Destinations$1 as Destinations, collector_InitConfig as InitConfig, Instance$4 as Instance, PushFn$1 as PushFn, collector_PushOptions as PushOptions, collector_SessionData as SessionData, collector_SourceStatus as SourceStatus, collector_Sources as Sources, collector_Status as Status, Transformers$1 as Transformers };
123
150
  }
124
151
 
125
152
  /**
@@ -262,6 +289,7 @@ interface Config$6<T extends TypesGeneric$2 = Types$3> {
262
289
  mapping?: Rules<Rule<Mapping$1<T>>>;
263
290
  policy?: Policy$1;
264
291
  queue?: boolean;
292
+ require?: string[];
265
293
  before?: string | string[];
266
294
  }
267
295
  type PartialConfig$1<T extends TypesGeneric$2 = Types$3> = Config$6<Types$3<Partial<Settings$2<T>> | Settings$2<T>, Partial<Mapping$1<T>> | Mapping$1<T>, Env$2<T>>>;
@@ -1192,41 +1220,57 @@ declare namespace mapping {
1192
1220
  }
1193
1221
 
1194
1222
  type Config$2 = {
1223
+ config?: Array<GenericConfig>;
1195
1224
  consent?: Array<ConsentConfig>;
1225
+ custom?: Array<GenericConfig>;
1226
+ globals?: Array<GenericConfig>;
1196
1227
  ready?: Array<ReadyConfig>;
1197
1228
  run?: Array<RunConfig>;
1198
1229
  session?: Array<SessionConfig>;
1230
+ user?: Array<UserConfig>;
1199
1231
  };
1200
- type Types$2 = keyof Config$2;
1232
+ type Types$2 = keyof Config$2 | (string & {});
1201
1233
  interface EventContextMap {
1234
+ config: Partial<Config$7>;
1202
1235
  consent: Consent;
1203
- session: SessionData;
1236
+ custom: Properties;
1237
+ globals: Properties;
1204
1238
  ready: undefined;
1205
1239
  run: undefined;
1240
+ session: SessionData;
1241
+ user: User;
1206
1242
  }
1207
- type EventContext<T extends Types$2> = EventContextMap[T];
1243
+ type EventContext<T extends keyof EventContextMap> = EventContextMap[T];
1208
1244
  type AnyEventContext = EventContextMap[keyof EventContextMap];
1209
1245
  interface Context$3 {
1210
1246
  consent?: Consent;
1211
1247
  session?: unknown;
1212
1248
  }
1213
- type Options = ConsentConfig | ReadyConfig | RunConfig | SessionConfig;
1249
+ type Options = ConsentConfig | GenericConfig | ReadyConfig | RunConfig | SessionConfig | UserConfig;
1214
1250
  interface ConsentConfig {
1215
1251
  [key: string]: ConsentFn;
1216
1252
  }
1217
1253
  type ConsentFn = (collector: Instance$4, consent: Consent) => void;
1254
+ type GenericConfig = GenericFn;
1255
+ type GenericFn = (collector: Instance$4, data: unknown) => void;
1218
1256
  type ReadyConfig = ReadyFn;
1219
1257
  type ReadyFn = (collector: Instance$4) => void;
1220
1258
  type RunConfig = RunFn;
1221
1259
  type RunFn = (collector: Instance$4) => void;
1222
1260
  type SessionConfig = SessionFn;
1223
1261
  type SessionFn = (collector: Instance$4, session?: unknown) => void;
1262
+ type UserConfig = UserFn;
1263
+ type UserFn = (collector: Instance$4, user: User) => void;
1224
1264
  interface OnConfig {
1265
+ config?: GenericConfig[];
1225
1266
  consent?: ConsentConfig[];
1267
+ custom?: GenericConfig[];
1268
+ globals?: GenericConfig[];
1226
1269
  ready?: ReadyConfig[];
1227
1270
  run?: RunConfig[];
1228
1271
  session?: SessionConfig[];
1229
- [key: string]: ConsentConfig[] | ReadyConfig[] | RunConfig[] | SessionConfig[] | undefined;
1272
+ user?: UserConfig[];
1273
+ [key: string]: ConsentConfig[] | GenericConfig[] | ReadyConfig[] | RunConfig[] | SessionConfig[] | UserConfig[] | undefined;
1230
1274
  }
1231
1275
  type OnFn<T extends TypesGeneric$2 = Types$3> = (type: Types$2, context: Context$4<T>) => PromiseOrValue<void>;
1232
1276
  type OnFnRuntime = (type: Types$2, context: Context$4) => PromiseOrValue<void>;
@@ -1234,8 +1278,10 @@ type OnFnRuntime = (type: Types$2, context: Context$4) => PromiseOrValue<void>;
1234
1278
  type on_AnyEventContext = AnyEventContext;
1235
1279
  type on_ConsentConfig = ConsentConfig;
1236
1280
  type on_ConsentFn = ConsentFn;
1237
- type on_EventContext<T extends Types$2> = EventContext<T>;
1281
+ type on_EventContext<T extends keyof EventContextMap> = EventContext<T>;
1238
1282
  type on_EventContextMap = EventContextMap;
1283
+ type on_GenericConfig = GenericConfig;
1284
+ type on_GenericFn = GenericFn;
1239
1285
  type on_OnConfig = OnConfig;
1240
1286
  type on_OnFn<T extends TypesGeneric$2 = Types$3> = OnFn<T>;
1241
1287
  type on_OnFnRuntime = OnFnRuntime;
@@ -1246,8 +1292,10 @@ type on_RunConfig = RunConfig;
1246
1292
  type on_RunFn = RunFn;
1247
1293
  type on_SessionConfig = SessionConfig;
1248
1294
  type on_SessionFn = SessionFn;
1295
+ type on_UserConfig = UserConfig;
1296
+ type on_UserFn = UserFn;
1249
1297
  declare namespace on {
1250
- export type { on_AnyEventContext as AnyEventContext, Config$2 as Config, on_ConsentConfig as ConsentConfig, on_ConsentFn as ConsentFn, Context$3 as Context, on_EventContext as EventContext, on_EventContextMap as EventContextMap, on_OnConfig as OnConfig, on_OnFn as OnFn, on_OnFnRuntime as OnFnRuntime, on_Options as Options, on_ReadyConfig as ReadyConfig, on_ReadyFn as ReadyFn, on_RunConfig as RunConfig, on_RunFn as RunFn, on_SessionConfig as SessionConfig, on_SessionFn as SessionFn, Types$2 as Types };
1298
+ export type { on_AnyEventContext as AnyEventContext, Config$2 as Config, on_ConsentConfig as ConsentConfig, on_ConsentFn as ConsentFn, Context$3 as Context, on_EventContext as EventContext, on_EventContextMap as EventContextMap, on_GenericConfig as GenericConfig, on_GenericFn as GenericFn, on_OnConfig as OnConfig, on_OnFn as OnFn, on_OnFnRuntime as OnFnRuntime, on_Options as Options, on_ReadyConfig as ReadyConfig, on_ReadyFn as ReadyFn, on_RunConfig as RunConfig, on_RunFn as RunFn, on_SessionConfig as SessionConfig, on_SessionFn as SessionFn, Types$2 as Types, on_UserConfig as UserConfig, on_UserFn as UserFn };
1251
1299
  }
1252
1300
 
1253
1301
  /**
@@ -1299,7 +1347,7 @@ interface Config$1<T extends TypesGeneric$1 = Types$1> {
1299
1347
  env?: Env$1<T>;
1300
1348
  id?: string;
1301
1349
  logger?: Config$4;
1302
- next?: string;
1350
+ next?: string | string[];
1303
1351
  init?: boolean;
1304
1352
  }
1305
1353
  /**
@@ -1354,6 +1402,7 @@ type InitTransformer<T extends TypesGeneric$1 = Types$1> = {
1354
1402
  code: Init$1<T>;
1355
1403
  config?: Partial<Config$1<T>>;
1356
1404
  env?: Partial<Env$1<T>>;
1405
+ next?: string | string[];
1357
1406
  };
1358
1407
  /**
1359
1408
  * Transformers configuration for collector.
@@ -1483,6 +1532,7 @@ interface Config<T extends TypesGeneric = Types> extends Config$3<Mapping<T>> {
1483
1532
  logger?: Config$4;
1484
1533
  disabled?: boolean;
1485
1534
  primary?: boolean;
1535
+ require?: string[];
1486
1536
  /**
1487
1537
  * Ingest metadata extraction mapping.
1488
1538
  * Extracts values from raw request objects (Express req, Lambda event, etc.)
@@ -1503,7 +1553,7 @@ interface Instance<T extends TypesGeneric = Types> {
1503
1553
  config: Config<T>;
1504
1554
  push: Push<T>;
1505
1555
  destroy?(): void | Promise<void>;
1506
- on?(event: Types$2, context?: unknown): void | Promise<void>;
1556
+ on?(event: Types$2, context?: unknown): void | boolean | Promise<void | boolean>;
1507
1557
  }
1508
1558
  /**
1509
1559
  * Context provided to source init function.
@@ -1526,7 +1576,7 @@ type InitSource<T extends TypesGeneric = Types> = {
1526
1576
  config?: Partial<Config<T>>;
1527
1577
  env?: Partial<Env<T>>;
1528
1578
  primary?: boolean;
1529
- next?: string;
1579
+ next?: string | string[];
1530
1580
  };
1531
1581
  /**
1532
1582
  * Sources configuration for collector.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,i=(e,n)=>{for(var o in n)t(e,o,{get:n[o],enumerable:!0})},s={};i(s,{Collector:()=>a,Const:()=>x,Context:()=>c,Data:()=>u,Destination:()=>l,Elb:()=>f,Flow:()=>p,Hooks:()=>d,Level:()=>m,Logger:()=>g,Mapping:()=>y,On:()=>b,Request:()=>h,Schema:()=>w,Source:()=>j,Transformer:()=>v,WalkerOS:()=>O,anonymizeIP:()=>k,assign:()=>N,castToProperty:()=>fe,castValue:()=>G,clone:()=>q,createDestination:()=>X,createEvent:()=>Q,createLogger:()=>ae,createMockLogger:()=>we,debounce:()=>ne,filterValues:()=>le,getBrowser:()=>Pe,getBrowserVersion:()=>$e,getByPath:()=>W,getDeviceType:()=>_e,getEvent:()=>Y,getFlowConfig:()=>T,getGrantedConsent:()=>J,getHeaders:()=>ke,getId:()=>ee,getMappingEvent:()=>ge,getMappingValue:()=>me,getMarketingParameters:()=>te,getOS:()=>Me,getOSVersion:()=>Te,getPlatform:()=>_,isArguments:()=>D,isArray:()=>V,isBoolean:()=>I,isCommand:()=>L,isDefined:()=>R,isElementOrDocument:()=>z,isFunction:()=>F,isNumber:()=>B,isObject:()=>K,isPropertyType:()=>ue,isSameType:()=>U,isString:()=>H,mockEnv:()=>ve,packageNameToVariable:()=>$,parseUserAgent:()=>Ae,processEventMapping:()=>be,requestToData:()=>je,requestToParameter:()=>Oe,setByPath:()=>Z,throttle:()=>oe,throwError:()=>E,transformData:()=>xe,traverseEnv:()=>he,trim:()=>Ee,tryCatch:()=>pe,tryCatchAsync:()=>de,useHooks:()=>Se,validateEvent:()=>Ce,validateProperty:()=>Ne,wrapCondition:()=>Ve,wrapFn:()=>Ie,wrapValidate:()=>Le}),module.exports=(e=s,((e,i,s,a)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let c of o(i))r.call(e,c)||c===s||t(e,c,{get:()=>i[c],enumerable:!(a=n(i,c))||a.enumerable});return e})(t({},"__esModule",{value:!0}),e));var a={},c={},u={},l={},f={},p={},d={},g={};i(g,{Level:()=>m});var m=(e=>(e[e.ERROR=0]="ERROR",e[e.INFO=1]="INFO",e[e.DEBUG=2]="DEBUG",e))(m||{}),y={},b={},v={},h={},w={},j={},O={},x={Utils:{Storage:{Local:"local",Session:"session",Cookie:"cookie"}}};function k(e){return/^(?:\d{1,3}\.){3}\d{1,3}$/.test(e)?e.replace(/\.\d+$/,".0"):""}function E(e){throw new Error(String(e))}function S(...e){const t={};for(const n of e)n&&Object.assign(t,n);return t}function A(...e){const t={};for(const n of e)n&&Object.assign(t,n);return t}function P(e,t,n){if("string"==typeof e){const o=e.match(/^\$def\.([a-zA-Z_][a-zA-Z0-9_]*)$/);if(o){const e=o[1];return void 0===n[e]&&E(`Definition "${e}" not found`),P(n[e],t,n)}let r=e.replace(/\$var\.([a-zA-Z_][a-zA-Z0-9_]*)/g,(e,n)=>{if(void 0!==t[n])return String(t[n]);E(`Variable "${n}" not found`)});return r=r.replace(/\$env\.([a-zA-Z_][a-zA-Z0-9_]*)(?::([^"}\s]*))?/g,(e,t,n)=>"undefined"!=typeof process&&void 0!==process.env?.[t]?process.env[t]:void 0!==n?n:void E(`Environment variable "${t}" not found and no default provided`)),r}if(Array.isArray(e))return e.map(e=>P(e,t,n));if(null!==e&&"object"==typeof e){const o={};for(const[r,i]of Object.entries(e))o[r]=P(i,t,n);return o}return e}function $(e){const t=e.startsWith("@"),n=e.replace("@","").replace(/[/-]/g,"_").split("_").filter(e=>e.length>0).map((e,t)=>0===t?e:e.charAt(0).toUpperCase()+e.slice(1)).join("");return t?"_"+n:n}function M(e,t,n){if(t)return t;if(!e||!n)return;return n[e]?$(e):void 0}function T(e,t){const n=Object.keys(e.flows);t||(1===n.length?t=n[0]:E(`Multiple flows found (${n.join(", ")}). Please specify a flow.`));const o=e.flows[t];o||E(`Flow "${t}" not found. Available: ${n.join(", ")}`);const r=JSON.parse(JSON.stringify(o));if(r.sources)for(const[t,n]of Object.entries(r.sources)){const i=S(e.variables,o.variables,n.variables),s=A(e.definitions,o.definitions,n.definitions),a=P(n.config,i,s),c=M(n.package,n.code,r.packages),u="string"==typeof n.code||"object"==typeof n.code?n.code:void 0,l=c||u;r.sources[t]={package:n.package,config:a,env:n.env,primary:n.primary,variables:n.variables,definitions:n.definitions,next:n.next,code:l}}if(r.destinations)for(const[t,n]of Object.entries(r.destinations)){const i=S(e.variables,o.variables,n.variables),s=A(e.definitions,o.definitions,n.definitions),a=P(n.config,i,s),c=M(n.package,n.code,r.packages),u="string"==typeof n.code||"object"==typeof n.code?n.code:void 0,l=c||u;r.destinations[t]={package:n.package,config:a,env:n.env,variables:n.variables,definitions:n.definitions,before:n.before,code:l}}if(r.collector){const t=S(e.variables,o.variables),n=A(e.definitions,o.definitions),i=P(r.collector,t,n);r.collector=i}return r}function _(e){return void 0!==e.web?"web":void 0!==e.server?"server":void E("Config must have web or server key")}var C={merge:!0,shallow:!0,extend:!0};function N(e,t={},n={}){n={...C,...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 D(e){return"[object Arguments]"===Object.prototype.toString.call(e)}function V(e){return Array.isArray(e)}function I(e){return"boolean"==typeof e}function L(e){return"walker"===e}function R(e){return void 0!==e}function z(e){return e===document||e instanceof Element}function F(e){return"function"==typeof e}function B(e){return"number"==typeof e&&!Number.isNaN(e)}function K(e){return"object"==typeof e&&null!==e&&!V(e)&&"[object Object]"===Object.prototype.toString.call(e)}function U(e,t){return typeof e==typeof t}function H(e){return"string"==typeof e}function q(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]=q(e[o],t));return n}if("[object Array]"===n){const n=[];return t.set(e,n),e.forEach(e=>{n.push(q(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 W(e,t="",n){const o=t.split(".");let r=e;for(let e=0;e<o.length;e++){const t=o[e];if("*"===t&&V(r)){const t=o.slice(e+1).join("."),i=[];for(const e of r){const o=W(e,t,n);i.push(o)}return i}if(r=r instanceof Object?r[t]:void 0,!r)break}return R(r)?r:n}function Z(e,t,n){if(!K(e))return e;const o=q(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){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}function J(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 X(e,t){const n={...e};return n.config=N(e.config,t,{shallow:!0,merge:!0,extend:!0}),e.config.settings&&t.settings&&(n.config.settings=N(e.config.settings,t.settings,{shallow:!0,merge:!0,extend:!0})),e.config.mapping&&t.mapping&&(n.config.mapping=N(e.config.mapping,t.mapping,{shallow:!0,merge:!0,extend:!0})),n}function Q(e={}){const t=e.timestamp||(new Date).setHours(0,13,37,0),n=e.group||"gr0up",o=e.count||1,r=N({name:"entity action",data:{string:"foo",number:1,boolean:!0,array:[0,"text",!1],not:void 0},context:{dev:["test",1]},globals:{lang:"elb"},custom:{completely:"random"},user:{id:"us3r",device:"c00k13",session:"s3ss10n"},nested:[{entity:"child",data:{is:"subordinated"},nested:[],context:{element:["child",0]}}],consent:{functional:!0},id:`${t}-${n}-${o}`,trigger:"test",entity:"entity",action:"action",timestamp:t,timing:3.14,group:n,count:o,version:{source:"1.2.1",tagging:1},source:{type:"web",id:"https://localhost:80",previous_id:"http://remotehost:9001"}},e,{merge:!1});if(e.name){const[t,n]=e.name.split(" ")??[];t&&n&&(r.entity=t,r.action=n)}return r}function Y(e="entity action",t={}){const n=t.timestamp||(new Date).setHours(0,13,37,0),o={data:{id:"ers",name:"Everyday Ruck Snack",color:"black",size:"l",price:420}},r={data:{id:"cc",name:"Cool Cap",size:"one size",price:42}};return Q({...{"cart view":{data:{currency:"EUR",value:2*o.data.price},context:{shopping:["cart",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",data:{...o.data,quantity:2},context:{shopping:["cart",0]},nested:[]}],trigger:"load"},"checkout view":{data:{step:"payment",currency:"EUR",value:o.data.price+r.data.price},context:{shopping:["checkout",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",...o,context:{shopping:["checkout",0]},nested:[]},{entity:"product",...r,context:{shopping:["checkout",0]},nested:[]}],trigger:"load"},"order complete":{data:{id:"0rd3r1d",currency:"EUR",shipping:5.22,taxes:73.76,total:555},context:{shopping:["complete",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",...o,context:{shopping:["complete",0]},nested:[]},{entity:"product",...r,context:{shopping:["complete",0]},nested:[]},{entity:"gift",data:{name:"Surprise"},context:{shopping:["complete",0]},nested:[]}],trigger:"load"},"page view":{data:{domain:"www.example.com",title:"walkerOS documentation",referrer:"https://www.walkeros.io/",search:"?foo=bar",hash:"#hash",id:"/docs/"},globals:{pagegroup:"docs"},trigger:"load"},"product add":{...o,context:{shopping:["intent",0]},globals:{pagegroup:"shop"},nested:[],trigger:"click"},"product view":{...o,context:{shopping:["detail",0]},globals:{pagegroup:"shop"},nested:[],trigger:"load"},"product visible":{data:{...o.data,position:3,promo:!0},context:{shopping:["discover",0]},globals:{pagegroup:"shop"},nested:[],trigger:"load"},"promotion visible":{data:{name:"Setting up tracking easily",position:"hero"},context:{ab_test:["engagement",0]},globals:{pagegroup:"homepage"},trigger:"visible"},"session start":{data:{id:"s3ss10n",start:n,isNew:!0,count:1,runs:1,isStart:!0,storage:!0,referrer:"",device:"c00k13"},user:{id:"us3r",device:"c00k13",session:"s3ss10n",hash:"h4sh",address:"street number",email:"user@example.com",phone:"+49 123 456 789",userAgent:"Mozilla...",browser:"Chrome",browserVersion:"90",deviceType:"desktop",language:"de-DE",country:"DE",region:"HH",city:"Hamburg",zip:"20354",timezone:"Berlin",os:"walkerOS",osVersion:"1.0",screenSize:"1337x420",ip:"127.0.0.0",internal:!0,custom:"value"}}}[e],...t,name:e})}function ee(e=6){let t="";for(let n=36;t.length<e;)t+=(Math.random()*n|0).toString(n);return t}function te(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(N(r,t)).forEach(([t,r])=>{const i=e.searchParams.get(t);i&&(r===n&&(r=t,o[n]=t),o[r]=i)}),o}function ne(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 oe(e,t=1e3){let n=null;return function(...o){if(null===n)return n=setTimeout(()=>{n=null},t),e(...o)}}function re(e){return{message:e.message,name:e.name,stack:e.stack,cause:e.cause}}function ie(e,t){let n,o={};return e instanceof Error?(n=e.message,o.error=re(e)):n=e,void 0!==t&&(t instanceof Error?o.error=re(t):"object"==typeof t&&null!==t?(o={...o,...t},"error"in o&&o.error instanceof Error&&(o.error=re(o.error))):o.value=t),{message:n,context:o}}var se=(e,t,n,o)=>{const r=`${m[e]}${o.length>0?` [${o.join(":")}]`:""}`,i=Object.keys(n).length>0;0===e?i?console.error(r,t,n):console.error(r,t):i?console.log(r,t,n):console.log(r,t)};function ae(e={}){return ce({level:void 0!==e.level?function(e){return"string"==typeof e?m[e]:e}(e.level):0,handler:e.handler,scope:[]})}function ce(e){const{level:t,handler:n,scope:o}=e,r=(e,r,i)=>{if(e<=t){const t=ie(r,i);n?n(e,t.message,t.context,o,se):se(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=ie(e,t);throw n?n(0,r.message,r.context,o,se):se(0,r.message,r.context,o),new Error(r.message)},scope:e=>ce({level:t,handler:n,scope:[...o,e]})}}function ue(e){return I(e)||H(e)||B(e)||!R(e)||V(e)&&e.every(ue)||K(e)&&Object.values(e).every(ue)}function le(e){return I(e)||H(e)||B(e)?e:D(e)?le(Array.from(e)):V(e)?e.map(e=>le(e)).filter(e=>void 0!==e):K(e)?Object.entries(e).reduce((e,[t,n])=>{const o=le(n);return void 0!==o&&(e[t]=o),e},{}):void 0}function fe(e){return ue(e)?e:void 0}function pe(e,t,n){return function(...o){try{return e(...o)}catch(e){if(!t)return;return t(e)}finally{n?.()}}}function de(e,t,n){return async function(...o){try{return await e(...o)}catch(e){if(!t)return;return await t(e)}finally{await(n?.())}}}async function ge(e,t){const[n,o]=(e.name||"").split(" ");if(!t||!n||!o)return{};let r,i="",s=n,a=o;const c=t=>{if(t)return(t=V(t)?t:[t]).find(t=>!t.condition||t.condition(e))};t[s]||(s="*");const u=t[s];return u&&(u[a]||(a="*"),r=c(u[a])),r||(s="*",a="*",r=c(t[s]?.[a])),r&&(i=`${s} ${a}`),{eventMapping:r,mappingKey:i}}async function me(e,t={},n={}){if(!R(e))return;const o=K(e)&&e.consent||n.consent||n.collector?.consent,r=V(t)?t:[t];for(const t of r){const r=await de(ye)(e,t,{...n,consent:o});if(R(r))return r}}async function ye(e,t,n={}){const{collector:o,consent:r}=n;return(V(t)?t:[t]).reduce(async(t,i)=>{const s=await t;if(s)return s;const a=H(i)?{key:i}:i;if(!Object.keys(a).length)return;const{condition:c,consent:u,fn:l,key:f,loop:p,map:d,set:g,validate:m,value:y}=a;if(c&&!await de(c)(e,i,o))return;if(u&&!J(u,r))return y;let b=R(y)?y:e;if(l&&(b=await de(l)(e,i,n)),f&&(b=W(e,f,y)),p){const[t,o]=p,r="this"===t?[e]:await me(e,t,n);V(r)&&(b=(await Promise.all(r.map(e=>me(e,o,n)))).filter(R))}else d?b=await Object.entries(d).reduce(async(t,[o,r])=>{const i=await t,s=await me(e,r,n);return R(s)&&(i[o]=s),i},Promise.resolve({})):g&&(b=await Promise.all(g.map(t=>ye(e,t,n))));m&&!await de(m)(b)&&(b=void 0);const v=fe(b);return R(v)?v:fe(y)},Promise.resolve(void 0))}async function be(e,t,n){t.policy&&await Promise.all(Object.entries(t.policy).map(async([t,o])=>{const r=await me(e,o,{collector:n});e=Z(e,t,r)}));const{eventMapping:o,mappingKey:r}=await ge(e,t.mapping);o?.policy&&await Promise.all(Object.entries(o.policy).map(async([t,o])=>{const r=await me(e,o,{collector:n});e=Z(e,t,r)}));let i=t.data&&await me(e,t.data,{collector:n});if(o){if(o.ignore)return{event:e,data:i,mapping:o,mappingKey:r,ignore:!0};if(o.name&&(e.name=o.name),o.data){const t=o.data&&await me(e,o.data,{collector:n});i=K(i)&&K(t)?N(i,t):t}}return{event:e,data:i,mapping:o,mappingKey:r,ignore:!1}}function ve(e,t){const n=(e,o=[])=>new Proxy(e,{get(e,r){const i=e[r],s=[...o,r];return"function"==typeof i?(...e)=>t(s,e,i):i&&"object"==typeof i?n(i,s):i}});return n(e)}function he(e,t){const n=(e,o=[])=>{if(!e||"object"!=typeof e)return e;const r=Array.isArray(e)?[]:{};for(const[i,s]of Object.entries(e)){const e=[...o,i];Array.isArray(r)?r[Number(i)]=t(s,e):r[i]=t(s,e),s&&"object"==typeof s&&"function"!=typeof s&&(Array.isArray(r)?r[Number(i)]=n(s,e):r[i]=n(s,e))}return r};return n(e)}function we(){const e=[],t=jest.fn(e=>{const t=e instanceof Error?e.message:e;throw new Error(t)}),n=jest.fn(t=>{const n=we();return e.push(n),n});return{error:jest.fn(),info:jest.fn(),debug:jest.fn(),throw:t,scope:n,scopedLoggers:e}}function je(e){const t=String(e),n=t.split("?")[1]||t;return pe(()=>{const e=new URLSearchParams(n),t={};return e.forEach((e,n)=>{const o=n.split(/[[\]]+/).filter(Boolean);let r=t;o.forEach((t,n)=>{const i=n===o.length-1;if(V(r)){const s=parseInt(t,10);i?r[s]=G(e):(r[s]=r[s]||(isNaN(parseInt(o[n+1],10))?{}:[]),r=r[s])}else K(r)&&(i?r[t]=G(e):(r[t]=r[t]||(isNaN(parseInt(o[n+1],10))?{}:[]),r=r[t]))})}),t})()}function Oe(e){if(!e)return"";const t=[],n=encodeURIComponent;function o(e,r){null!=r&&(V(r)?r.forEach((t,n)=>o(`${e}[${n}]`,t)):K(r)?Object.entries(r).forEach(([t,n])=>o(`${e}[${t}]`,n)):t.push(`${n(e)}=${n(String(r))}`))}return"object"!=typeof e?n(e):(Object.entries(e).forEach(([e,t])=>o(e,t)),t.join("&"))}function xe(e){return void 0===e||U(e,"")?e:JSON.stringify(e)}function ke(e={}){return N({"Content-Type":"application/json; charset=utf-8"},e)}function Ee(e){return e?e.trim().replace(/^'|'$/g,"").trim():""}function Se(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 Ae(e){return e?{userAgent:e,browser:Pe(e),browserVersion:$e(e),os:Me(e),osVersion:Te(e),deviceType:_e(e)}:{}}function Pe(e){const t=[{name:"Edge",substr:"Edg"},{name:"Chrome",substr:"Chrome"},{name:"Safari",substr:"Safari",exclude:"Chrome"},{name:"Firefox",substr:"Firefox"},{name:"IE",substr:"MSIE"},{name:"IE",substr:"Trident"}];for(const n of t)if(e.includes(n.substr)&&(!n.exclude||!e.includes(n.exclude)))return n.name}function $e(e){const t=[/Edg\/([0-9]+)/,/Chrome\/([0-9]+)/,/Version\/([0-9]+).*Safari/,/Firefox\/([0-9]+)/,/MSIE ([0-9]+)/,/rv:([0-9]+).*Trident/];for(const n of t){const t=e.match(n);if(t)return t[1]}}function Me(e){const t=[{name:"Windows",substr:"Windows NT"},{name:"macOS",substr:"Mac OS X"},{name:"Android",substr:"Android"},{name:"iOS",substr:"iPhone OS"},{name:"Linux",substr:"Linux"}];for(const n of t)if(e.includes(n.substr))return n.name}function Te(e){const t=e.match(/(?:Windows NT|Mac OS X|Android|iPhone OS) ([0-9._]+)/);return t?t[1].replace(/_/g,"."):void 0}function _e(e){let t="Desktop";return/Tablet|iPad/i.test(e)?t="Tablet":/Mobi|Android|iPhone|iPod|BlackBerry|Opera Mini|IEMobile|WPDesktop/i.test(e)&&(t="Mobile"),t}function Ce(e,t=[]){let n,o,r;U(e,{})||E("Invalid object"),U(e.name,"")?(n=e.name,[o,r]=n.split(" "),o&&r||E("Invalid event name")):U(e.entity,"")&&U(e.action,"")?(o=e.entity,r=e.action,n=`${o} ${r}`):E("Missing or invalid name, entity, or action");const i={name:n,data:{},context:{},custom:{},globals:{},user:{},nested:[],consent:{},id:"",trigger:"",entity:o,action:r,timestamp:0,timing:0,group:"",count:0,version:{source:"",tagging:0},source:{type:"",id:"",previous_id:""}};return[{"*":{"*":{name:{maxLength:255},user:{allowedKeys:["id","device","session"]},consent:{allowedValues:[!0,!1]},timestamp:{min:0},timing:{min:0},count:{min:0},version:{allowedKeys:["source","tagging"]},source:{allowedKeys:["type","id","previous_id"]}}}}].concat(t).reduce((e,t)=>["*",o].reduce((e,n)=>["*",r].reduce((e,o)=>{const r=t[n]?.[o];return r?e.concat([r]):e},e),e),[]).reduce((t,n)=>{const o=Object.keys(n).filter(e=>{const t=n[e];return!0===t?.required});return[...Object.keys(e),...o].reduce((t,o)=>{const r=n[o];let i=e[o];return r&&(i=pe(Ne,e=>{E(String(e))})(t,o,i,r)),U(i,t[o])&&(t[o]=i),t},t)},i)}function Ne(e,t,n,o){if(o.validate&&(n=pe(o.validate,e=>{E(String(e))})(n,t,e)),o.required&&void 0===n&&E("Missing required property"),U(n,""))o.maxLength&&n.length>o.maxLength&&(o.strict&&E("Value exceeds maxLength"),n=n.substring(0,o.maxLength));else if(U(n,1))U(o.min,1)&&n<o.min?(o.strict&&E("Value below min"),n=o.min):U(o.max,1)&&n>o.max&&(o.strict&&E("Value exceeds max"),n=o.max);else if(U(n,{})){if(o.schema){const e=o.schema;Object.keys(e).reduce((t,n)=>{const o=e[n];let r=t[n];return o&&(o.type&&typeof r!==o.type&&E(`Type doesn't match (${n})`),r=pe(Ne,e=>{E(String(e))})(t,n,r,o)),r},n)}for(const e of Object.keys(n))o.allowedKeys&&!o.allowedKeys.includes(e)&&(o.strict&&E("Key not allowed"),delete n[e])}return n}function De(e){return function(e){return/\breturn\b/.test(e)}(e)?e:`return ${e}`}function Ve(e){const t=De(e);return new Function("value","mapping","collector",t)}function Ie(e){const t=De(e);return new Function("value","mapping","options",t)}function Le(e){const t=De(e);return new Function("value",t)}//# sourceMappingURL=index.js.map
1
+ "use strict";var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,i=(e,n)=>{for(var o in n)t(e,o,{get:n[o],enumerable:!0})},s={};i(s,{Collector:()=>a,Const:()=>x,Context:()=>c,Data:()=>u,Destination:()=>l,Elb:()=>f,Flow:()=>p,Hooks:()=>d,Level:()=>m,Logger:()=>g,Mapping:()=>y,On:()=>b,Request:()=>h,Schema:()=>w,Source:()=>j,Transformer:()=>v,WalkerOS:()=>O,anonymizeIP:()=>k,assign:()=>N,castToProperty:()=>fe,castValue:()=>G,clone:()=>q,createDestination:()=>X,createEvent:()=>Q,createLogger:()=>ae,createMockLogger:()=>we,debounce:()=>ne,filterValues:()=>le,getBrowser:()=>Pe,getBrowserVersion:()=>$e,getByPath:()=>W,getDeviceType:()=>_e,getEvent:()=>Y,getFlowConfig:()=>T,getGrantedConsent:()=>J,getHeaders:()=>ke,getId:()=>ee,getMappingEvent:()=>ge,getMappingValue:()=>me,getMarketingParameters:()=>te,getOS:()=>Me,getOSVersion:()=>Te,getPlatform:()=>_,isArguments:()=>D,isArray:()=>V,isBoolean:()=>I,isCommand:()=>L,isDefined:()=>R,isElementOrDocument:()=>z,isFunction:()=>F,isNumber:()=>B,isObject:()=>K,isPropertyType:()=>ue,isSameType:()=>U,isString:()=>H,mockEnv:()=>ve,packageNameToVariable:()=>$,parseUserAgent:()=>Ae,processEventMapping:()=>be,requestToData:()=>je,requestToParameter:()=>Oe,setByPath:()=>Z,throttle:()=>oe,throwError:()=>E,transformData:()=>xe,traverseEnv:()=>he,trim:()=>Ee,tryCatch:()=>pe,tryCatchAsync:()=>de,useHooks:()=>Se,validateEvent:()=>Ce,validateProperty:()=>Ne,wrapCondition:()=>Ve,wrapFn:()=>Ie,wrapValidate:()=>Le}),module.exports=(e=s,((e,i,s,a)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let c of o(i))r.call(e,c)||c===s||t(e,c,{get:()=>i[c],enumerable:!(a=n(i,c))||a.enumerable});return e})(t({},"__esModule",{value:!0}),e));var a={},c={},u={},l={},f={},p={},d={},g={};i(g,{Level:()=>m});var m=(e=>(e[e.ERROR=0]="ERROR",e[e.INFO=1]="INFO",e[e.DEBUG=2]="DEBUG",e))(m||{}),y={},b={},v={},h={},w={},j={},O={},x={Utils:{Storage:{Local:"local",Session:"session",Cookie:"cookie"}}};function k(e){return/^(?:\d{1,3}\.){3}\d{1,3}$/.test(e)?e.replace(/\.\d+$/,".0"):""}function E(e){throw new Error(String(e))}function S(...e){const t={};for(const n of e)n&&Object.assign(t,n);return t}function A(...e){const t={};for(const n of e)n&&Object.assign(t,n);return t}function P(e,t,n){if("string"==typeof e){const o=e.match(/^\$def\.([a-zA-Z_][a-zA-Z0-9_]*)$/);if(o){const e=o[1];return void 0===n[e]&&E(`Definition "${e}" not found`),P(n[e],t,n)}let r=e.replace(/\$var\.([a-zA-Z_][a-zA-Z0-9_]*)/g,(e,n)=>{if(void 0!==t[n])return String(t[n]);E(`Variable "${n}" not found`)});return r=r.replace(/\$env\.([a-zA-Z_][a-zA-Z0-9_]*)(?::([^"}\s]*))?/g,(e,t,n)=>"undefined"!=typeof process&&void 0!==process.env?.[t]?process.env[t]:void 0!==n?n:void E(`Environment variable "${t}" not found and no default provided`)),r}if(Array.isArray(e))return e.map(e=>P(e,t,n));if(null!==e&&"object"==typeof e){const o={};for(const[r,i]of Object.entries(e))o[r]=P(i,t,n);return o}return e}function $(e){const t=e.startsWith("@"),n=e.replace("@","").replace(/[/-]/g,"_").split("_").filter(e=>e.length>0).map((e,t)=>0===t?e:e.charAt(0).toUpperCase()+e.slice(1)).join("");return t?"_"+n:n}function M(e,t,n){if(t)return t;if(!e||!n)return;return n[e]?$(e):void 0}function T(e,t){const n=Object.keys(e.flows);t||(1===n.length?t=n[0]:E(`Multiple flows found (${n.join(", ")}). Please specify a flow.`));const o=e.flows[t];o||E(`Flow "${t}" not found. Available: ${n.join(", ")}`);const r=JSON.parse(JSON.stringify(o));if(r.sources)for(const[t,n]of Object.entries(r.sources)){const i=S(e.variables,o.variables,n.variables),s=A(e.definitions,o.definitions,n.definitions),a=P(n.config,i,s),c=M(n.package,n.code,r.packages),u="string"==typeof n.code||"object"==typeof n.code?n.code:void 0,l=c||u;r.sources[t]={package:n.package,config:a,env:n.env,primary:n.primary,variables:n.variables,definitions:n.definitions,next:n.next,code:l}}if(r.destinations)for(const[t,n]of Object.entries(r.destinations)){const i=S(e.variables,o.variables,n.variables),s=A(e.definitions,o.definitions,n.definitions),a=P(n.config,i,s),c=M(n.package,n.code,r.packages),u="string"==typeof n.code||"object"==typeof n.code?n.code:void 0,l=c||u;r.destinations[t]={package:n.package,config:a,env:n.env,variables:n.variables,definitions:n.definitions,before:n.before,code:l}}if(r.collector){const t=S(e.variables,o.variables),n=A(e.definitions,o.definitions),i=P(r.collector,t,n);r.collector=i}return r}function _(e){return void 0!==e.web?"web":void 0!==e.server?"server":void E("Config must have web or server key")}var C={merge:!0,shallow:!0,extend:!0};function N(e,t={},n={}){n={...C,...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 D(e){return"[object Arguments]"===Object.prototype.toString.call(e)}function V(e){return Array.isArray(e)}function I(e){return"boolean"==typeof e}function L(e){return"walker"===e}function R(e){return void 0!==e}function z(e){return e===document||e instanceof Element}function F(e){return"function"==typeof e}function B(e){return"number"==typeof e&&!Number.isNaN(e)}function K(e){return"object"==typeof e&&null!==e&&!V(e)&&"[object Object]"===Object.prototype.toString.call(e)}function U(e,t){return typeof e==typeof t}function H(e){return"string"==typeof e}function q(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]=q(e[o],t));return n}if("[object Array]"===n){const n=[];return t.set(e,n),e.forEach(e=>{n.push(q(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 W(e,t="",n){const o=t.split(".");let r=e;for(let e=0;e<o.length;e++){const t=o[e];if("*"===t&&V(r)){const t=o.slice(e+1).join("."),i=[];for(const e of r){const o=W(e,t,n);i.push(o)}return i}if(r=r instanceof Object?r[t]:void 0,!r)break}return R(r)?r:n}function Z(e,t,n){if(!K(e))return e;const o=q(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){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}function J(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 X(e,t){const n={...e};return n.config=N(e.config,t,{shallow:!0,merge:!0,extend:!0}),e.config.settings&&t.settings&&(n.config.settings=N(e.config.settings,t.settings,{shallow:!0,merge:!0,extend:!0})),e.config.mapping&&t.mapping&&(n.config.mapping=N(e.config.mapping,t.mapping,{shallow:!0,merge:!0,extend:!0})),n}function Q(e={}){const t=e.timestamp||(new Date).setHours(0,13,37,0),n=e.group||"gr0up",o=e.count||1,r=N({name:"entity action",data:{string:"foo",number:1,boolean:!0,array:[0,"text",!1],not:void 0},context:{dev:["test",1]},globals:{lang:"elb"},custom:{completely:"random"},user:{id:"us3r",device:"c00k13",session:"s3ss10n"},nested:[{entity:"child",data:{is:"subordinated"},nested:[],context:{element:["child",0]}}],consent:{functional:!0},id:`${t}-${n}-${o}`,trigger:"test",entity:"entity",action:"action",timestamp:t,timing:3.14,group:n,count:o,version:{source:"1.2.2",tagging:1},source:{type:"web",id:"https://localhost:80",previous_id:"http://remotehost:9001"}},e,{merge:!1});if(e.name){const[t,n]=e.name.split(" ")??[];t&&n&&(r.entity=t,r.action=n)}return r}function Y(e="entity action",t={}){const n=t.timestamp||(new Date).setHours(0,13,37,0),o={data:{id:"ers",name:"Everyday Ruck Snack",color:"black",size:"l",price:420}},r={data:{id:"cc",name:"Cool Cap",size:"one size",price:42}};return Q({...{"cart view":{data:{currency:"EUR",value:2*o.data.price},context:{shopping:["cart",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",data:{...o.data,quantity:2},context:{shopping:["cart",0]},nested:[]}],trigger:"load"},"checkout view":{data:{step:"payment",currency:"EUR",value:o.data.price+r.data.price},context:{shopping:["checkout",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",...o,context:{shopping:["checkout",0]},nested:[]},{entity:"product",...r,context:{shopping:["checkout",0]},nested:[]}],trigger:"load"},"order complete":{data:{id:"0rd3r1d",currency:"EUR",shipping:5.22,taxes:73.76,total:555},context:{shopping:["complete",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",...o,context:{shopping:["complete",0]},nested:[]},{entity:"product",...r,context:{shopping:["complete",0]},nested:[]},{entity:"gift",data:{name:"Surprise"},context:{shopping:["complete",0]},nested:[]}],trigger:"load"},"page view":{data:{domain:"www.example.com",title:"walkerOS documentation",referrer:"https://www.walkeros.io/",search:"?foo=bar",hash:"#hash",id:"/docs/"},globals:{pagegroup:"docs"},trigger:"load"},"product add":{...o,context:{shopping:["intent",0]},globals:{pagegroup:"shop"},nested:[],trigger:"click"},"product view":{...o,context:{shopping:["detail",0]},globals:{pagegroup:"shop"},nested:[],trigger:"load"},"product visible":{data:{...o.data,position:3,promo:!0},context:{shopping:["discover",0]},globals:{pagegroup:"shop"},nested:[],trigger:"load"},"promotion visible":{data:{name:"Setting up tracking easily",position:"hero"},context:{ab_test:["engagement",0]},globals:{pagegroup:"homepage"},trigger:"visible"},"session start":{data:{id:"s3ss10n",start:n,isNew:!0,count:1,runs:1,isStart:!0,storage:!0,referrer:"",device:"c00k13"},user:{id:"us3r",device:"c00k13",session:"s3ss10n",hash:"h4sh",address:"street number",email:"user@example.com",phone:"+49 123 456 789",userAgent:"Mozilla...",browser:"Chrome",browserVersion:"90",deviceType:"desktop",language:"de-DE",country:"DE",region:"HH",city:"Hamburg",zip:"20354",timezone:"Berlin",os:"walkerOS",osVersion:"1.0",screenSize:"1337x420",ip:"127.0.0.0",internal:!0,custom:"value"}}}[e],...t,name:e})}function ee(e=6){let t="";for(let n=36;t.length<e;)t+=(Math.random()*n|0).toString(n);return t}function te(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(N(r,t)).forEach(([t,r])=>{const i=e.searchParams.get(t);i&&(r===n&&(r=t,o[n]=t),o[r]=i)}),o}function ne(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 oe(e,t=1e3){let n=null;return function(...o){if(null===n)return n=setTimeout(()=>{n=null},t),e(...o)}}function re(e){return{message:e.message,name:e.name,stack:e.stack,cause:e.cause}}function ie(e,t){let n,o={};return e instanceof Error?(n=e.message,o.error=re(e)):n=e,void 0!==t&&(t instanceof Error?o.error=re(t):"object"==typeof t&&null!==t?(o={...o,...t},"error"in o&&o.error instanceof Error&&(o.error=re(o.error))):o.value=t),{message:n,context:o}}var se=(e,t,n,o)=>{const r=`${m[e]}${o.length>0?` [${o.join(":")}]`:""}`,i=Object.keys(n).length>0;0===e?i?console.error(r,t,n):console.error(r,t):i?console.log(r,t,n):console.log(r,t)};function ae(e={}){return ce({level:void 0!==e.level?function(e){return"string"==typeof e?m[e]:e}(e.level):0,handler:e.handler,scope:[]})}function ce(e){const{level:t,handler:n,scope:o}=e,r=(e,r,i)=>{if(e<=t){const t=ie(r,i);n?n(e,t.message,t.context,o,se):se(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=ie(e,t);throw n?n(0,r.message,r.context,o,se):se(0,r.message,r.context,o),new Error(r.message)},scope:e=>ce({level:t,handler:n,scope:[...o,e]})}}function ue(e){return I(e)||H(e)||B(e)||!R(e)||V(e)&&e.every(ue)||K(e)&&Object.values(e).every(ue)}function le(e){return I(e)||H(e)||B(e)?e:D(e)?le(Array.from(e)):V(e)?e.map(e=>le(e)).filter(e=>void 0!==e):K(e)?Object.entries(e).reduce((e,[t,n])=>{const o=le(n);return void 0!==o&&(e[t]=o),e},{}):void 0}function fe(e){return ue(e)?e:void 0}function pe(e,t,n){return function(...o){try{return e(...o)}catch(e){if(!t)return;return t(e)}finally{n?.()}}}function de(e,t,n){return async function(...o){try{return await e(...o)}catch(e){if(!t)return;return await t(e)}finally{await(n?.())}}}async function ge(e,t){const[n,o]=(e.name||"").split(" ");if(!t||!n||!o)return{};let r,i="",s=n,a=o;const c=t=>{if(t)return(t=V(t)?t:[t]).find(t=>!t.condition||t.condition(e))};t[s]||(s="*");const u=t[s];return u&&(u[a]||(a="*"),r=c(u[a])),r||(s="*",a="*",r=c(t[s]?.[a])),r&&(i=`${s} ${a}`),{eventMapping:r,mappingKey:i}}async function me(e,t={},n={}){if(!R(e))return;const o=K(e)&&e.consent||n.consent||n.collector?.consent,r=V(t)?t:[t];for(const t of r){const r=await de(ye)(e,t,{...n,consent:o});if(R(r))return r}}async function ye(e,t,n={}){const{collector:o,consent:r}=n;return(V(t)?t:[t]).reduce(async(t,i)=>{const s=await t;if(s)return s;const a=H(i)?{key:i}:i;if(!Object.keys(a).length)return;const{condition:c,consent:u,fn:l,key:f,loop:p,map:d,set:g,validate:m,value:y}=a;if(c&&!await de(c)(e,i,o))return;if(u&&!J(u,r))return y;let b=R(y)?y:e;if(l&&(b=await de(l)(e,i,n)),f&&(b=W(e,f,y)),p){const[t,o]=p,r="this"===t?[e]:await me(e,t,n);V(r)&&(b=(await Promise.all(r.map(e=>me(e,o,n)))).filter(R))}else d?b=await Object.entries(d).reduce(async(t,[o,r])=>{const i=await t,s=await me(e,r,n);return R(s)&&(i[o]=s),i},Promise.resolve({})):g&&(b=await Promise.all(g.map(t=>ye(e,t,n))));m&&!await de(m)(b)&&(b=void 0);const v=fe(b);return R(v)?v:fe(y)},Promise.resolve(void 0))}async function be(e,t,n){t.policy&&await Promise.all(Object.entries(t.policy).map(async([t,o])=>{const r=await me(e,o,{collector:n});e=Z(e,t,r)}));const{eventMapping:o,mappingKey:r}=await ge(e,t.mapping);o?.policy&&await Promise.all(Object.entries(o.policy).map(async([t,o])=>{const r=await me(e,o,{collector:n});e=Z(e,t,r)}));let i=t.data&&await me(e,t.data,{collector:n});if(o){if(o.ignore)return{event:e,data:i,mapping:o,mappingKey:r,ignore:!0};if(o.name&&(e.name=o.name),o.data){const t=o.data&&await me(e,o.data,{collector:n});i=K(i)&&K(t)?N(i,t):t}}return{event:e,data:i,mapping:o,mappingKey:r,ignore:!1}}function ve(e,t){const n=(e,o=[])=>new Proxy(e,{get(e,r){const i=e[r],s=[...o,r];return"function"==typeof i?(...e)=>t(s,e,i):i&&"object"==typeof i?n(i,s):i}});return n(e)}function he(e,t){const n=(e,o=[])=>{if(!e||"object"!=typeof e)return e;const r=Array.isArray(e)?[]:{};for(const[i,s]of Object.entries(e)){const e=[...o,i];Array.isArray(r)?r[Number(i)]=t(s,e):r[i]=t(s,e),s&&"object"==typeof s&&"function"!=typeof s&&(Array.isArray(r)?r[Number(i)]=n(s,e):r[i]=n(s,e))}return r};return n(e)}function we(){const e=[],t=jest.fn(e=>{const t=e instanceof Error?e.message:e;throw new Error(t)}),n=jest.fn(t=>{const n=we();return e.push(n),n});return{error:jest.fn(),info:jest.fn(),debug:jest.fn(),throw:t,scope:n,scopedLoggers:e}}function je(e){const t=String(e),n=t.split("?")[1]||t;return pe(()=>{const e=new URLSearchParams(n),t={};return e.forEach((e,n)=>{const o=n.split(/[[\]]+/).filter(Boolean);let r=t;o.forEach((t,n)=>{const i=n===o.length-1;if(V(r)){const s=parseInt(t,10);i?r[s]=G(e):(r[s]=r[s]||(isNaN(parseInt(o[n+1],10))?{}:[]),r=r[s])}else K(r)&&(i?r[t]=G(e):(r[t]=r[t]||(isNaN(parseInt(o[n+1],10))?{}:[]),r=r[t]))})}),t})()}function Oe(e){if(!e)return"";const t=[],n=encodeURIComponent;function o(e,r){null!=r&&(V(r)?r.forEach((t,n)=>o(`${e}[${n}]`,t)):K(r)?Object.entries(r).forEach(([t,n])=>o(`${e}[${t}]`,n)):t.push(`${n(e)}=${n(String(r))}`))}return"object"!=typeof e?n(e):(Object.entries(e).forEach(([e,t])=>o(e,t)),t.join("&"))}function xe(e){return void 0===e||U(e,"")?e:JSON.stringify(e)}function ke(e={}){return N({"Content-Type":"application/json; charset=utf-8"},e)}function Ee(e){return e?e.trim().replace(/^'|'$/g,"").trim():""}function Se(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 Ae(e){return e?{userAgent:e,browser:Pe(e),browserVersion:$e(e),os:Me(e),osVersion:Te(e),deviceType:_e(e)}:{}}function Pe(e){const t=[{name:"Edge",substr:"Edg"},{name:"Chrome",substr:"Chrome"},{name:"Safari",substr:"Safari",exclude:"Chrome"},{name:"Firefox",substr:"Firefox"},{name:"IE",substr:"MSIE"},{name:"IE",substr:"Trident"}];for(const n of t)if(e.includes(n.substr)&&(!n.exclude||!e.includes(n.exclude)))return n.name}function $e(e){const t=[/Edg\/([0-9]+)/,/Chrome\/([0-9]+)/,/Version\/([0-9]+).*Safari/,/Firefox\/([0-9]+)/,/MSIE ([0-9]+)/,/rv:([0-9]+).*Trident/];for(const n of t){const t=e.match(n);if(t)return t[1]}}function Me(e){const t=[{name:"Windows",substr:"Windows NT"},{name:"macOS",substr:"Mac OS X"},{name:"Android",substr:"Android"},{name:"iOS",substr:"iPhone OS"},{name:"Linux",substr:"Linux"}];for(const n of t)if(e.includes(n.substr))return n.name}function Te(e){const t=e.match(/(?:Windows NT|Mac OS X|Android|iPhone OS) ([0-9._]+)/);return t?t[1].replace(/_/g,"."):void 0}function _e(e){let t="Desktop";return/Tablet|iPad/i.test(e)?t="Tablet":/Mobi|Android|iPhone|iPod|BlackBerry|Opera Mini|IEMobile|WPDesktop/i.test(e)&&(t="Mobile"),t}function Ce(e,t=[]){let n,o,r;U(e,{})||E("Invalid object"),U(e.name,"")?(n=e.name,[o,r]=n.split(" "),o&&r||E("Invalid event name")):U(e.entity,"")&&U(e.action,"")?(o=e.entity,r=e.action,n=`${o} ${r}`):E("Missing or invalid name, entity, or action");const i={name:n,data:{},context:{},custom:{},globals:{},user:{},nested:[],consent:{},id:"",trigger:"",entity:o,action:r,timestamp:0,timing:0,group:"",count:0,version:{source:"",tagging:0},source:{type:"",id:"",previous_id:""}};return[{"*":{"*":{name:{maxLength:255},user:{allowedKeys:["id","device","session"]},consent:{allowedValues:[!0,!1]},timestamp:{min:0},timing:{min:0},count:{min:0},version:{allowedKeys:["source","tagging"]},source:{allowedKeys:["type","id","previous_id"]}}}}].concat(t).reduce((e,t)=>["*",o].reduce((e,n)=>["*",r].reduce((e,o)=>{const r=t[n]?.[o];return r?e.concat([r]):e},e),e),[]).reduce((t,n)=>{const o=Object.keys(n).filter(e=>{const t=n[e];return!0===t?.required});return[...Object.keys(e),...o].reduce((t,o)=>{const r=n[o];let i=e[o];return r&&(i=pe(Ne,e=>{E(String(e))})(t,o,i,r)),U(i,t[o])&&(t[o]=i),t},t)},i)}function Ne(e,t,n,o){if(o.validate&&(n=pe(o.validate,e=>{E(String(e))})(n,t,e)),o.required&&void 0===n&&E("Missing required property"),U(n,""))o.maxLength&&n.length>o.maxLength&&(o.strict&&E("Value exceeds maxLength"),n=n.substring(0,o.maxLength));else if(U(n,1))U(o.min,1)&&n<o.min?(o.strict&&E("Value below min"),n=o.min):U(o.max,1)&&n>o.max&&(o.strict&&E("Value exceeds max"),n=o.max);else if(U(n,{})){if(o.schema){const e=o.schema;Object.keys(e).reduce((t,n)=>{const o=e[n];let r=t[n];return o&&(o.type&&typeof r!==o.type&&E(`Type doesn't match (${n})`),r=pe(Ne,e=>{E(String(e))})(t,n,r,o)),r},n)}for(const e of Object.keys(n))o.allowedKeys&&!o.allowedKeys.includes(e)&&(o.strict&&E("Key not allowed"),delete n[e])}return n}function De(e){return function(e){return/\breturn\b/.test(e)}(e)?e:`return ${e}`}function Ve(e){const t=De(e);return new Function("value","mapping","collector",t)}function Ie(e){const t=De(e);return new Function("value","mapping","options",t)}function Le(e){const t=De(e);return new Function("value",t)}//# sourceMappingURL=index.js.map