@walkeros/explorer 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,587 @@
1
+ "use client"
2
+
3
+ // src/utils/monaco-context-types.ts
4
+ var FN_CONTEXT_TYPES = `
5
+ // WalkerOS Core Types
6
+ declare namespace WalkerOS {
7
+ // Utility types
8
+ type DeepPartial<T> = {
9
+ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
10
+ };
11
+
12
+ type PromiseOrValue<T> = T | Promise<T>;
13
+
14
+ // Property types
15
+ type PropertyType = boolean | string | number | {
16
+ [key: string]: Property;
17
+ };
18
+
19
+ type Property = PropertyType | Array<PropertyType>;
20
+
21
+ interface Properties {
22
+ [key: string]: Property | undefined;
23
+ }
24
+
25
+ interface OrderedProperties {
26
+ [key: string]: [Property, number] | undefined;
27
+ }
28
+
29
+ // Consent
30
+ interface Consent {
31
+ [name: string]: boolean;
32
+ }
33
+
34
+ // User
35
+ interface User extends Properties {
36
+ id?: string;
37
+ device?: string;
38
+ session?: string;
39
+ hash?: string;
40
+ address?: string;
41
+ email?: string;
42
+ phone?: string;
43
+ userAgent?: string;
44
+ browser?: string;
45
+ browserVersion?: string;
46
+ deviceType?: string;
47
+ language?: string;
48
+ country?: string;
49
+ region?: string;
50
+ city?: string;
51
+ zip?: string;
52
+ timezone?: string;
53
+ os?: string;
54
+ osVersion?: string;
55
+ screenSize?: string;
56
+ ip?: string;
57
+ internal?: boolean;
58
+ }
59
+
60
+ // Version
61
+ interface Version extends Properties {
62
+ source: string;
63
+ tagging: number;
64
+ }
65
+
66
+ // Source
67
+ type SourceType = 'web' | 'server' | 'app' | 'other' | string;
68
+
69
+ interface Source extends Properties {
70
+ type: SourceType;
71
+ id: string;
72
+ previous_id: string;
73
+ }
74
+
75
+ // Entity
76
+ type Entities = Array<Entity>;
77
+
78
+ interface Entity {
79
+ entity: string;
80
+ data: Properties;
81
+ nested: Entities;
82
+ context: OrderedProperties;
83
+ }
84
+
85
+ // Event
86
+ interface Event {
87
+ name: string;
88
+ data: Properties;
89
+ context: OrderedProperties;
90
+ globals: Properties;
91
+ custom: Properties;
92
+ user: User;
93
+ nested: Entities;
94
+ consent: Consent;
95
+ id: string;
96
+ trigger: string;
97
+ entity: string;
98
+ action: string;
99
+ timestamp: number;
100
+ timing: number;
101
+ group: string;
102
+ count: number;
103
+ version: Version;
104
+ source: Source;
105
+ }
106
+
107
+ type DeepPartialEvent = DeepPartial<Event>;
108
+ }
109
+
110
+ // Mapping Types
111
+ declare namespace Mapping {
112
+ type ValueType = string | ValueConfig;
113
+ type Value = ValueType | Array<ValueType>;
114
+ type Values = Array<Value>;
115
+
116
+ interface ValueConfig {
117
+ condition?: Condition;
118
+ consent?: WalkerOS.Consent;
119
+ fn?: Fn;
120
+ key?: string;
121
+ loop?: Loop;
122
+ map?: Map;
123
+ set?: Value[];
124
+ validate?: Validate;
125
+ value?: WalkerOS.PropertyType;
126
+ }
127
+
128
+ type Loop = [Value, Value];
129
+
130
+ type Map = {
131
+ [key: string]: Value;
132
+ };
133
+
134
+ interface Options {
135
+ consent?: WalkerOS.Consent;
136
+ collector?: Collector.Instance;
137
+ props?: unknown;
138
+ }
139
+
140
+ type Condition = (
141
+ value: WalkerOS.DeepPartialEvent | unknown,
142
+ mapping?: Value,
143
+ collector?: Collector.Instance
144
+ ) => WalkerOS.PromiseOrValue<boolean>;
145
+
146
+ type Fn = (
147
+ value: WalkerOS.DeepPartialEvent | unknown,
148
+ mapping: Value,
149
+ options: Options
150
+ ) => WalkerOS.PromiseOrValue<WalkerOS.Property | unknown>;
151
+
152
+ type Validate = (value?: unknown) => WalkerOS.PromiseOrValue<boolean>;
153
+ }
154
+
155
+ // Collector Types (minimal for fn context)
156
+ declare namespace Collector {
157
+ interface Instance {
158
+ push: any;
159
+ command: any;
160
+ allowed: boolean;
161
+ config: any;
162
+ consent: WalkerOS.Consent;
163
+ count: number;
164
+ custom: WalkerOS.Properties;
165
+ globals: WalkerOS.Properties;
166
+ group: string;
167
+ queue: any[];
168
+ round: number;
169
+ session: any;
170
+ timing: number;
171
+ user: WalkerOS.User;
172
+ version: string;
173
+ [key: string]: any;
174
+ }
175
+ }
176
+
177
+ // Parameter declarations for fn context
178
+ declare const value: WalkerOS.DeepPartialEvent | unknown;
179
+ declare const mapping: Mapping.Value;
180
+ declare const options: Mapping.Options;
181
+ `;
182
+ var CONDITION_CONTEXT_TYPES = `
183
+ // WalkerOS Core Types
184
+ declare namespace WalkerOS {
185
+ // Utility types
186
+ type DeepPartial<T> = {
187
+ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
188
+ };
189
+
190
+ type PromiseOrValue<T> = T | Promise<T>;
191
+
192
+ // Property types
193
+ type PropertyType = boolean | string | number | {
194
+ [key: string]: Property;
195
+ };
196
+
197
+ type Property = PropertyType | Array<PropertyType>;
198
+
199
+ interface Properties {
200
+ [key: string]: Property | undefined;
201
+ }
202
+
203
+ interface OrderedProperties {
204
+ [key: string]: [Property, number] | undefined;
205
+ }
206
+
207
+ // Consent
208
+ interface Consent {
209
+ [name: string]: boolean;
210
+ }
211
+
212
+ // User
213
+ interface User extends Properties {
214
+ id?: string;
215
+ device?: string;
216
+ session?: string;
217
+ hash?: string;
218
+ address?: string;
219
+ email?: string;
220
+ phone?: string;
221
+ userAgent?: string;
222
+ browser?: string;
223
+ browserVersion?: string;
224
+ deviceType?: string;
225
+ language?: string;
226
+ country?: string;
227
+ region?: string;
228
+ city?: string;
229
+ zip?: string;
230
+ timezone?: string;
231
+ os?: string;
232
+ osVersion?: string;
233
+ screenSize?: string;
234
+ ip?: string;
235
+ internal?: boolean;
236
+ }
237
+
238
+ // Version
239
+ interface Version extends Properties {
240
+ source: string;
241
+ tagging: number;
242
+ }
243
+
244
+ // Source
245
+ type SourceType = 'web' | 'server' | 'app' | 'other' | string;
246
+
247
+ interface Source extends Properties {
248
+ type: SourceType;
249
+ id: string;
250
+ previous_id: string;
251
+ }
252
+
253
+ // Entity
254
+ type Entities = Array<Entity>;
255
+
256
+ interface Entity {
257
+ entity: string;
258
+ data: Properties;
259
+ nested: Entities;
260
+ context: OrderedProperties;
261
+ }
262
+
263
+ // Event
264
+ interface Event {
265
+ name: string;
266
+ data: Properties;
267
+ context: OrderedProperties;
268
+ globals: Properties;
269
+ custom: Properties;
270
+ user: User;
271
+ nested: Entities;
272
+ consent: Consent;
273
+ id: string;
274
+ trigger: string;
275
+ entity: string;
276
+ action: string;
277
+ timestamp: number;
278
+ timing: number;
279
+ group: string;
280
+ count: number;
281
+ version: Version;
282
+ source: Source;
283
+ }
284
+
285
+ type DeepPartialEvent = DeepPartial<Event>;
286
+ }
287
+
288
+ // Mapping Types
289
+ declare namespace Mapping {
290
+ type ValueType = string | ValueConfig;
291
+ type Value = ValueType | Array<ValueType>;
292
+
293
+ interface ValueConfig {
294
+ condition?: Condition;
295
+ consent?: WalkerOS.Consent;
296
+ fn?: Fn;
297
+ key?: string;
298
+ loop?: Loop;
299
+ map?: Map;
300
+ set?: Value[];
301
+ validate?: Validate;
302
+ value?: WalkerOS.PropertyType;
303
+ }
304
+
305
+ type Loop = [Value, Value];
306
+
307
+ type Map = {
308
+ [key: string]: Value;
309
+ };
310
+
311
+ type Condition = (
312
+ value: WalkerOS.DeepPartialEvent | unknown,
313
+ mapping?: Value,
314
+ collector?: Collector.Instance
315
+ ) => WalkerOS.PromiseOrValue<boolean>;
316
+
317
+ type Fn = (
318
+ value: WalkerOS.DeepPartialEvent | unknown,
319
+ mapping: Value,
320
+ options: any
321
+ ) => WalkerOS.PromiseOrValue<WalkerOS.Property | unknown>;
322
+
323
+ type Validate = (value?: unknown) => WalkerOS.PromiseOrValue<boolean>;
324
+ }
325
+
326
+ // Collector Types (full interface for condition context)
327
+ declare namespace Collector {
328
+ interface SessionData extends WalkerOS.Properties {
329
+ isStart: boolean;
330
+ storage: boolean;
331
+ id?: string;
332
+ start?: number;
333
+ marketing?: true;
334
+ updated?: number;
335
+ isNew?: boolean;
336
+ device?: string;
337
+ count?: number;
338
+ runs?: number;
339
+ }
340
+
341
+ interface Config {
342
+ run?: boolean;
343
+ tagging: number;
344
+ globalsStatic: WalkerOS.Properties;
345
+ sessionStatic: Partial<SessionData>;
346
+ verbose: boolean;
347
+ onError?: any;
348
+ onLog?: any;
349
+ }
350
+
351
+ interface Instance {
352
+ push: any;
353
+ command: any;
354
+ allowed: boolean;
355
+ config: Config;
356
+ consent: WalkerOS.Consent;
357
+ count: number;
358
+ custom: WalkerOS.Properties;
359
+ sources: any;
360
+ destinations: any;
361
+ globals: WalkerOS.Properties;
362
+ group: string;
363
+ hooks: any;
364
+ on: any;
365
+ queue: any[];
366
+ round: number;
367
+ session: undefined | SessionData;
368
+ timing: number;
369
+ user: WalkerOS.User;
370
+ version: string;
371
+ }
372
+ }
373
+
374
+ // Parameter declarations for condition context
375
+ declare const value: WalkerOS.DeepPartialEvent | unknown;
376
+ declare const mapping: Mapping.Value;
377
+ declare const collector: Collector.Instance | undefined;
378
+ `;
379
+ var VALIDATE_CONTEXT_TYPES = `
380
+ // Parameter declaration for validate context
381
+ declare const value: unknown;
382
+ `;
383
+ function getContextTypes(contextType) {
384
+ switch (contextType) {
385
+ case "fn":
386
+ return FN_CONTEXT_TYPES;
387
+ case "condition":
388
+ return CONDITION_CONTEXT_TYPES;
389
+ case "validate":
390
+ return VALIDATE_CONTEXT_TYPES;
391
+ default:
392
+ return "";
393
+ }
394
+ }
395
+
396
+ // walkeros-types:virtual:walkeros-core-types
397
+ var virtual_walkeros_core_types_default = '/**\n * Core collector configuration interface\n */\ninterface Config$5 {\n /** Whether to run collector automatically */\n run?: boolean;\n /** Version for event tagging */\n tagging: number;\n /** Static global properties even on a new run */\n globalsStatic: Properties;\n /** Static session data even on a new run */\n sessionStatic: Partial<SessionData>;\n /** Enable verbose logging */\n verbose: boolean;\n /** Error handler */\n onError?: Error;\n /** Log handler */\n onLog?: Log;\n}\n/**\n * Initialization configuration that extends Config with initial state\n */\ninterface InitConfig extends Partial<Config$5> {\n /** Initial consent state */\n consent?: Consent;\n /** Initial user data */\n user?: User;\n /** Initial global properties */\n globals?: Properties;\n /** Source configurations */\n sources?: InitSources;\n /** Destination configurations */\n destinations?: InitDestinations;\n /** Initial custom properties */\n custom?: Properties;\n}\ninterface SessionData extends Properties {\n isStart: boolean;\n storage: boolean;\n id?: string;\n start?: number;\n marketing?: true;\n updated?: number;\n isNew?: boolean;\n device?: string;\n count?: number;\n runs?: number;\n}\ninterface Sources {\n [id: string]: Instance;\n}\ninterface Destinations$1 {\n [id: string]: Instance$1;\n}\ntype CommandType = \'action\' | \'config\' | \'consent\' | \'context\' | \'destination\' | \'elb\' | \'globals\' | \'hook\' | \'init\' | \'link\' | \'run\' | \'user\' | \'walker\' | string;\n/**\n * Context passed to collector.push for source mapping\n */\ninterface PushContext$1 {\n mapping?: Config$2;\n}\n/**\n * Push function signature - handles events only\n */\ninterface PushFn$1 {\n (event: DeepPartialEvent, context?: PushContext$1): Promise<PushResult>;\n}\n/**\n * Command function signature - handles walker commands only\n */\ninterface CommandFn {\n (command: \'config\', config: Partial<Config$5>): Promise<PushResult>;\n (command: \'consent\', consent: Consent): Promise<PushResult>;\n <T extends Types$2>(command: \'destination\', destination: Init$1<T> | Instance$1<T>, config?: Config$4<T>): Promise<PushResult>;\n <K extends keyof Functions>(command: \'hook\', name: K, hookFn: Functions[K]): Promise<PushResult>;\n (command: \'on\', type: Types$1, rules: SingleOrArray<Options>): Promise<PushResult>;\n (command: \'user\', user: User): Promise<PushResult>;\n (command: \'run\', runState?: {\n consent?: Consent;\n user?: User;\n globals?: Properties;\n custom?: Properties;\n }): Promise<PushResult>;\n (command: string, data?: unknown, options?: unknown): Promise<PushResult>;\n}\ninterface Instance$2 {\n push: PushFn$1;\n command: CommandFn;\n allowed: boolean;\n config: Config$5;\n consent: Consent;\n count: number;\n custom: Properties;\n sources: Sources;\n destinations: Destinations$1;\n globals: Properties;\n group: string;\n hooks: Functions;\n on: OnConfig;\n queue: Events;\n round: number;\n session: undefined | SessionData;\n timing: number;\n user: User;\n version: string;\n}\n\ntype collector_CommandFn = CommandFn;\ntype collector_CommandType = CommandType;\ntype collector_InitConfig = InitConfig;\ntype collector_SessionData = SessionData;\ntype collector_Sources = Sources;\ndeclare namespace collector {\n export type { collector_CommandFn as CommandFn, collector_CommandType as CommandType, Config$5 as Config, Destinations$1 as Destinations, collector_InitConfig as InitConfig, Instance$2 as Instance, PushContext$1 as PushContext, PushFn$1 as PushFn, collector_SessionData as SessionData, collector_Sources as Sources };\n}\n\ninterface Contract$1 {\n version: string;\n globals: Globals;\n context: Contexts;\n entities: Entities$1;\n}\ninterface Globals {\n [name: string]: Global;\n}\ninterface Contexts {\n [name: string]: Context$3;\n}\ninterface Entities$1 {\n [name: string]: Entity$1;\n}\ninterface Properties$2 {\n [name: string]: Property$2;\n}\ninterface Global extends Property$2 {\n}\ninterface Context$3 extends Property$2 {\n}\ninterface Entity$1 {\n data: Properties$2;\n actions: Actions;\n}\ninterface Actions {\n [name: string]: Action;\n}\ninterface Action {\n trigger?: Trigger;\n}\ntype Trigger = string;\ninterface Property$2 {\n type?: PropertyType$1;\n required?: boolean;\n values?: PropertyValues;\n}\ntype PropertyType$1 = \'boolean\' | \'string\' | \'number\';\ntype PropertyValues = Array<Property>;\n\ntype data_Action = Action;\ntype data_Actions = Actions;\ntype data_Contexts = Contexts;\ntype data_Global = Global;\ntype data_Globals = Globals;\ntype data_PropertyValues = PropertyValues;\ntype data_Trigger = Trigger;\ndeclare namespace data {\n export type { data_Action as Action, data_Actions as Actions, Context$3 as Context, data_Contexts as Contexts, Contract$1 as Contract, Entities$1 as Entities, Entity$1 as Entity, data_Global as Global, data_Globals as Globals, Properties$2 as Properties, Property$2 as Property, PropertyType$1 as PropertyType, data_PropertyValues as PropertyValues, data_Trigger as Trigger };\n}\n\n/**\n * Base environment requirements interface for walkerOS destinations\n *\n * This defines the core interface that destinations can use to declare\n * their runtime environment requirements. Platform-specific extensions\n * should extend this interface.\n */\ninterface BaseEnv$1 {\n /**\n * Generic global properties that destinations may require\n * Platform-specific implementations can extend this interface\n */\n [key: string]: unknown;\n}\n/**\n * Type bundle for destination generics.\n * Groups Settings, Mapping, and Env into a single type parameter.\n */\ninterface Types$2<S = unknown, M = unknown, E = BaseEnv$1> {\n settings: S;\n mapping: M;\n env: E;\n}\n/**\n * Generic constraint for Types - ensures T has required properties for indexed access\n */\ntype TypesGeneric$1 = {\n settings: any;\n mapping: any;\n env: any;\n};\n/**\n * Type extractors for consistent usage with Types bundle\n */\ntype Settings$1<T extends TypesGeneric$1 = Types$2> = T[\'settings\'];\ntype Mapping$1<T extends TypesGeneric$1 = Types$2> = T[\'mapping\'];\ntype Env$1<T extends TypesGeneric$1 = Types$2> = T[\'env\'];\n/**\n * Inference helper: Extract Types from Instance\n */\ntype TypesOf$1<I> = I extends Instance$1<infer T> ? T : never;\ninterface Instance$1<T extends TypesGeneric$1 = Types$2> {\n config: Config$4<T>;\n queue?: Events;\n dlq?: DLQ;\n type?: string;\n env?: Env$1<T>;\n init?: InitFn<T>;\n push: PushFn<T>;\n pushBatch?: PushBatchFn<T>;\n on?: OnFn;\n}\ninterface Config$4<T extends TypesGeneric$1 = Types$2> {\n consent?: Consent;\n settings?: Settings$1<T>;\n data?: Value | Values;\n env?: Env$1<T>;\n id?: string;\n init?: boolean;\n loadScript?: boolean;\n mapping?: Rules<Rule<Mapping$1<T>>>;\n policy?: Policy$1;\n queue?: boolean;\n verbose?: boolean;\n onError?: Error;\n onLog?: Log;\n}\ntype PartialConfig$1<T extends TypesGeneric$1 = Types$2> = Config$4<Types$2<Partial<Settings$1<T>> | Settings$1<T>, Partial<Mapping$1<T>> | Mapping$1<T>, Env$1<T>>>;\ninterface Policy$1 {\n [key: string]: Value;\n}\ntype Init$1<T extends TypesGeneric$1 = Types$2> = {\n code: Instance$1<T>;\n config?: Partial<Config$4<T>>;\n env?: Partial<Env$1<T>>;\n};\ninterface InitDestinations {\n [key: string]: Init$1<any>;\n}\ninterface Destinations {\n [key: string]: Instance$1;\n}\ninterface Context$2<T extends TypesGeneric$1 = Types$2> {\n collector: Instance$2;\n config: Config$4<T>;\n data?: Data$1;\n env: Env$1<T>;\n}\ninterface InitContext<T extends TypesGeneric$1 = Types$2> {\n collector: Instance$2;\n config: Config$4<Types$2<Partial<Settings$1<T>>, Mapping$1<T>, Env$1<T>>>;\n data?: Data$1;\n env: Env$1<T>;\n}\ninterface PushContext<T extends TypesGeneric$1 = Types$2> extends Context$2<T> {\n mapping?: Rule<Mapping$1<T>>;\n}\ninterface PushBatchContext<T extends TypesGeneric$1 = Types$2> extends Context$2<T> {\n mapping?: Rule<Mapping$1<T>>;\n}\ntype InitFn<T extends TypesGeneric$1 = Types$2> = (context: InitContext<T>) => PromiseOrValue<void | false | Config$4<T>>;\ntype PushFn<T extends TypesGeneric$1 = Types$2> = (event: Event, context: PushContext<T>) => PromiseOrValue<void>;\ntype PushBatchFn<T extends TypesGeneric$1 = Types$2> = (batch: Batch<Mapping$1<T>>, context: PushBatchContext<T>) => void;\ntype PushEvent<Mapping = unknown> = {\n event: Event;\n mapping?: Rule<Mapping>;\n};\ntype PushEvents<Mapping = unknown> = Array<PushEvent<Mapping>>;\ninterface Batch<Mapping> {\n key: string;\n events: Events;\n data: Array<Data$1>;\n mapping?: Rule<Mapping>;\n}\ntype Data$1 = Property | undefined | Array<Property | undefined>;\ntype Ref = {\n id: string;\n destination: Instance$1;\n};\ntype Push$1 = {\n queue?: Events;\n error?: unknown;\n};\ntype DLQ = Array<[Event, unknown]>;\ntype Result$1 = {\n successful: Array<Ref>;\n queued: Array<Ref>;\n failed: Array<Ref>;\n};\n\ntype destination_Batch<Mapping> = Batch<Mapping>;\ntype destination_DLQ = DLQ;\ntype destination_Destinations = Destinations;\ntype destination_InitContext<T extends TypesGeneric$1 = Types$2> = InitContext<T>;\ntype destination_InitDestinations = InitDestinations;\ntype destination_InitFn<T extends TypesGeneric$1 = Types$2> = InitFn<T>;\ntype destination_PushBatchContext<T extends TypesGeneric$1 = Types$2> = PushBatchContext<T>;\ntype destination_PushBatchFn<T extends TypesGeneric$1 = Types$2> = PushBatchFn<T>;\ntype destination_PushContext<T extends TypesGeneric$1 = Types$2> = PushContext<T>;\ntype destination_PushEvent<Mapping = unknown> = PushEvent<Mapping>;\ntype destination_PushEvents<Mapping = unknown> = PushEvents<Mapping>;\ntype destination_PushFn<T extends TypesGeneric$1 = Types$2> = PushFn<T>;\ntype destination_Ref = Ref;\ndeclare namespace destination {\n export type { BaseEnv$1 as BaseEnv, destination_Batch as Batch, Config$4 as Config, Context$2 as Context, destination_DLQ as DLQ, Data$1 as Data, destination_Destinations as Destinations, Env$1 as Env, Init$1 as Init, destination_InitContext as InitContext, destination_InitDestinations as InitDestinations, destination_InitFn as InitFn, Instance$1 as Instance, Mapping$1 as Mapping, PartialConfig$1 as PartialConfig, Policy$1 as Policy, Push$1 as Push, destination_PushBatchContext as PushBatchContext, destination_PushBatchFn as PushBatchFn, destination_PushContext as PushContext, destination_PushEvent as PushEvent, destination_PushEvents as PushEvents, destination_PushFn as PushFn, destination_Ref as Ref, Result$1 as Result, Settings$1 as Settings, Types$2 as Types, TypesGeneric$1 as TypesGeneric, TypesOf$1 as TypesOf };\n}\n\ninterface EventFn<R = Promise<PushResult>> {\n (partialEvent: DeepPartialEvent): R;\n (event: string): R;\n (event: string, data: Properties): R;\n}\ninterface Fn$1<R = Promise<PushResult>, Config = unknown> extends EventFn<R>, WalkerCommands<R, Config> {\n}\ninterface WalkerCommands<R = Promise<PushResult>, Config = unknown> {\n (event: \'walker config\', config: Partial<Config>): R;\n (event: \'walker consent\', consent: Consent): R;\n <T extends Types$2>(event: \'walker destination\', destination: Init$1<T> | Instance$1<T>, config?: Config$4<T>): R;\n <K extends keyof Functions>(event: \'walker hook\', name: K, hookFn: Functions[K]): R;\n (event: \'walker on\', type: Types$1, rules: SingleOrArray<Options>): R;\n (event: \'walker user\', user: User): R;\n (event: \'walker run\', runState: {\n consent?: Consent;\n user?: User;\n globals?: Properties;\n custom?: Properties;\n }): R;\n}\ntype Event$1<R = Promise<PushResult>> = (partialEvent: DeepPartialEvent) => R;\ntype PushData<Config = unknown> = DeepPartial<Config> | Consent | User | Properties;\ninterface PushResult extends Result$1 {\n event?: Event;\n ok: boolean;\n}\ntype Layer = Array<IArguments | DeepPartialEvent | unknown[]>;\n\ntype elb_EventFn<R = Promise<PushResult>> = EventFn<R>;\ntype elb_Layer = Layer;\ntype elb_PushData<Config = unknown> = PushData<Config>;\ntype elb_PushResult = PushResult;\ntype elb_WalkerCommands<R = Promise<PushResult>, Config = unknown> = WalkerCommands<R, Config>;\ndeclare namespace elb {\n export type { Event$1 as Event, elb_EventFn as EventFn, Fn$1 as Fn, elb_Layer as Layer, elb_PushData as PushData, elb_PushResult as PushResult, elb_WalkerCommands as WalkerCommands };\n}\n\n/**\n * Flow Configuration System\n *\n * Core types for walkerOS unified configuration.\n * Platform-agnostic, runtime-focused.\n *\n * The Flow system enables "one config to rule them all" - a single\n * walkeros.config.json file that manages multiple environments\n * (web_prod, web_stage, server_prod, etc.) with shared configuration,\n * variables, and reusable definitions.\n *\n * @packageDocumentation\n */\n\n/**\n * Primitive value types for variables\n */\ntype Primitive = string | number | boolean;\n/**\n * Complete multi-environment configuration.\n * This is the root type for walkeros.config.json files.\n *\n * @remarks\n * The Setup interface represents the entire configuration file,\n * containing multiple named environments that can share variables\n * and definitions.\n *\n * @example\n * ```json\n * {\n * "version": 1,\n * "$schema": "https://walkeros.io/schema/flow/v1.json",\n * "variables": {\n * "CURRENCY": "USD"\n * },\n * "environments": {\n * "web_prod": { "platform": "web", ... },\n * "server_prod": { "platform": "server", ... }\n * }\n * }\n * ```\n */\ninterface Setup {\n /**\n * Configuration schema version.\n * Used for compatibility checks and migrations.\n *\n * @remarks\n * - Version 1: Initial Flow configuration system\n * - Future versions will be documented as they\'re released\n */\n version: 1;\n /**\n * JSON Schema reference for IDE validation and autocomplete.\n *\n * @remarks\n * When set, IDEs like VSCode will provide:\n * - Autocomplete for all fields\n * - Inline documentation\n * - Validation errors before deployment\n *\n * @example\n * "$schema": "https://walkeros.io/schema/flow/v1.json"\n */\n $schema?: string;\n /**\n * Shared variables for interpolation across all environments.\n *\n * @remarks\n * Variables can be referenced using `${VAR_NAME:default}` syntax.\n * Resolution order:\n * 1. Environment variable (process.env.VAR_NAME)\n * 2. Config variable (config.variables.VAR_NAME)\n * 3. Inline default value\n *\n * @example\n * ```json\n * {\n * "variables": {\n * "CURRENCY": "USD",\n * "GA4_ID": "G-DEFAULT"\n * },\n * "environments": {\n * "prod": {\n * "collector": {\n * "globals": {\n * "currency": "${CURRENCY}"\n * }\n * }\n * }\n * }\n * }\n * ```\n */\n variables?: Record<string, Primitive>;\n /**\n * Reusable configuration definitions.\n *\n * @remarks\n * Definitions can be referenced using JSON Schema `$ref` syntax.\n * Useful for sharing mapping rules, common settings, etc.\n *\n * @example\n * ```json\n * {\n * "definitions": {\n * "gtag_base_mapping": {\n * "page": {\n * "view": { "name": "page_view" }\n * }\n * }\n * },\n * "environments": {\n * "prod": {\n * "destinations": {\n * "gtag": {\n * "config": {\n * "mapping": { "$ref": "#/definitions/gtag_base_mapping" }\n * }\n * }\n * }\n * }\n * }\n * }\n * ```\n */\n definitions?: Record<string, unknown>;\n /**\n * Named environment configurations.\n *\n * @remarks\n * Each environment represents a deployment target:\n * - web_prod, web_stage, web_dev (client-side tracking)\n * - server_prod, server_stage (server-side collection)\n *\n * Environment names are arbitrary and user-defined.\n *\n * @example\n * ```json\n * {\n * "environments": {\n * "web_prod": {\n * "platform": "web",\n * "sources": { ... },\n * "destinations": { ... }\n * },\n * "server_prod": {\n * "platform": "server",\n * "destinations": { ... }\n * }\n * }\n * }\n * ```\n */\n environments: Record<string, Config$3>;\n}\n/**\n * Single environment configuration.\n * Represents one deployment target (e.g., web_prod, server_stage).\n *\n * @remarks\n * This is the core runtime configuration used by `startFlow()`.\n * Platform-agnostic and independent of build/deployment tools.\n *\n * Extensions (build, docker, etc.) are added via `[key: string]: unknown`.\n */\ninterface Config$3 {\n /**\n * Target platform for this environment.\n *\n * @remarks\n * - `web`: Browser-based tracking (IIFE bundles, browser sources)\n * - `server`: Node.js server-side collection (CJS bundles, HTTP sources)\n *\n * This determines:\n * - Available packages (web-* vs server-*)\n * - Default build settings\n * - Template selection\n */\n platform: \'web\' | \'server\';\n /**\n * Source configurations (data capture).\n *\n * @remarks\n * Sources capture events from various origins:\n * - Browser DOM interactions (clicks, page views)\n * - DataLayer pushes\n * - HTTP requests (server-side)\n * - Cloud function triggers\n *\n * Key = unique source identifier (arbitrary)\n * Value = source reference with package and config\n *\n * @example\n * ```json\n * {\n * "sources": {\n * "browser": {\n * "package": "@walkeros/web-source-browser",\n * "config": {\n * "settings": {\n * "pageview": true,\n * "session": true\n * }\n * }\n * }\n * }\n * }\n * ```\n */\n sources?: Record<string, SourceReference>;\n /**\n * Destination configurations (data output).\n *\n * @remarks\n * Destinations send processed events to external services:\n * - Google Analytics (gtag)\n * - Meta Pixel (fbq)\n * - Custom APIs\n * - Data warehouses\n *\n * Key = unique destination identifier (arbitrary)\n * Value = destination reference with package and config\n *\n * @example\n * ```json\n * {\n * "destinations": {\n * "gtag": {\n * "package": "@walkeros/web-destination-gtag",\n * "config": {\n * "settings": {\n * "ga4": { "measurementId": "G-XXXXXXXXXX" }\n * }\n * }\n * }\n * }\n * }\n * ```\n */\n destinations?: Record<string, DestinationReference>;\n /**\n * Collector configuration (event processing).\n *\n * @remarks\n * The collector is the central event processing engine.\n * Configuration includes:\n * - Consent management\n * - Global properties\n * - User identification\n * - Processing rules\n *\n * @see {@link Collector.InitConfig} for complete options\n *\n * @example\n * ```json\n * {\n * "collector": {\n * "run": true,\n * "tagging": 1,\n * "consent": {\n * "functional": true,\n * "marketing": false\n * },\n * "globals": {\n * "currency": "USD",\n * "environment": "production"\n * }\n * }\n * }\n * ```\n */\n collector?: InitConfig;\n /**\n * Environment-specific variables.\n *\n * @remarks\n * These override root-level variables for this specific environment.\n * Useful for environment-specific API keys, endpoints, etc.\n *\n * @example\n * ```json\n * {\n * "env": {\n * "API_ENDPOINT": "https://api.production.com",\n * "DEBUG": "false"\n * }\n * }\n * ```\n */\n env?: Record<string, string>;\n /**\n * Extension point for package-specific fields.\n *\n * @remarks\n * Allows packages to add their own configuration fields:\n * - CLI adds `build` field (Bundle.Config)\n * - Docker adds `docker` field (Docker.Config)\n * - Lambda adds `lambda` field (Lambda.Config)\n *\n * Core doesn\'t validate these fields - packages handle validation.\n */\n [key: string]: unknown;\n}\n/**\n * Source reference with inline package syntax.\n *\n * @remarks\n * References a source package and provides configuration.\n * The package is automatically downloaded and imported during build.\n */\ninterface SourceReference {\n /**\n * Package specifier with optional version.\n *\n * @remarks\n * Formats:\n * - `"@walkeros/web-source-browser"` - Latest version\n * - `"@walkeros/web-source-browser@2.0.0"` - Specific version\n * - `"@walkeros/web-source-browser@^2.0.0"` - Semver range\n *\n * The CLI will:\n * 1. Parse the package reference\n * 2. Download from npm\n * 3. Auto-detect default or named export\n * 4. Generate import statement\n *\n * @example\n * "package": "@walkeros/web-source-browser@latest"\n */\n package: string;\n /**\n * Source-specific configuration.\n *\n * @remarks\n * Structure depends on the source package.\n * Passed to the source\'s initialization function.\n *\n * @example\n * ```json\n * {\n * "config": {\n * "settings": {\n * "pageview": true,\n * "session": true,\n * "elb": "elb",\n * "prefix": "data-elb"\n * }\n * }\n * }\n * ```\n */\n config?: unknown;\n /**\n * Source environment configuration.\n *\n * @remarks\n * Environment-specific settings for the source.\n * Merged with default source environment.\n */\n env?: unknown;\n /**\n * Mark as primary source (provides main ELB).\n *\n * @remarks\n * The primary source\'s ELB function is returned by `startFlow()`.\n * Only one source should be marked as primary per environment.\n *\n * @default false\n */\n primary?: boolean;\n}\n/**\n * Destination reference with inline package syntax.\n *\n * @remarks\n * References a destination package and provides configuration.\n * Structure mirrors SourceReference for consistency.\n */\ninterface DestinationReference {\n /**\n * Package specifier with optional version.\n *\n * @remarks\n * Same format as SourceReference.package\n *\n * @example\n * "package": "@walkeros/web-destination-gtag@2.0.0"\n */\n package: string;\n /**\n * Destination-specific configuration.\n *\n * @remarks\n * Structure depends on the destination package.\n * Typically includes:\n * - settings: API keys, IDs, endpoints\n * - mapping: Event transformation rules\n * - consent: Required consent states\n * - policy: Processing rules\n *\n * @example\n * ```json\n * {\n * "config": {\n * "settings": {\n * "ga4": {\n * "measurementId": "G-XXXXXXXXXX"\n * }\n * },\n * "mapping": {\n * "page": {\n * "view": {\n * "name": "page_view",\n * "data": { ... }\n * }\n * }\n * }\n * }\n * }\n * ```\n */\n config?: unknown;\n /**\n * Destination environment configuration.\n *\n * @remarks\n * Environment-specific settings for the destination.\n * Merged with default destination environment.\n */\n env?: unknown;\n}\n\ntype flow_DestinationReference = DestinationReference;\ntype flow_Primitive = Primitive;\ntype flow_Setup = Setup;\ntype flow_SourceReference = SourceReference;\ndeclare namespace flow {\n export type { Config$3 as Config, flow_DestinationReference as DestinationReference, flow_Primitive as Primitive, flow_Setup as Setup, flow_SourceReference as SourceReference };\n}\n\ntype Error = (error: unknown, state?: unknown) => void;\ntype Log = (message: string, verbose?: boolean) => void;\n\ntype handler_Error = Error;\ntype handler_Log = Log;\ndeclare namespace handler {\n export type { handler_Error as Error, handler_Log as Log };\n}\n\ntype AnyFunction$1<P extends unknown[] = never[], R = unknown> = (...args: P) => R;\ntype Functions = {\n [key: string]: AnyFunction$1;\n};\ninterface Parameter<P extends unknown[], R> {\n fn: (...args: P) => R;\n result?: R;\n}\ntype HookFn<T extends AnyFunction$1> = (params: Parameter<Parameters<T>, ReturnType<T>>, ...args: Parameters<T>) => ReturnType<T>;\n\ntype hooks_Functions = Functions;\ntype hooks_HookFn<T extends AnyFunction$1> = HookFn<T>;\ndeclare namespace hooks {\n export type { AnyFunction$1 as AnyFunction, hooks_Functions as Functions, hooks_HookFn as HookFn };\n}\n\n/**\n * Shared mapping configuration interface.\n * Used by both Source.Config and Destination.Config.\n */\ninterface Config$2<T = unknown> {\n consent?: Consent;\n data?: Value | Values;\n mapping?: Rules<Rule<T>>;\n policy?: Policy;\n}\ninterface Policy {\n [key: string]: Value;\n}\ninterface Rules<T = Rule> {\n [entity: string]: Record<string, T | Array<T>> | undefined;\n}\ninterface Rule<Settings = unknown> {\n batch?: number;\n batchFn?: (destination: Instance$1, collector: Instance$2) => void;\n batched?: Batch<Settings>;\n condition?: Condition;\n consent?: Consent;\n settings?: Settings;\n data?: Data;\n ignore?: boolean;\n name?: string;\n policy?: Policy;\n}\ninterface Result {\n eventMapping?: Rule;\n mappingKey?: string;\n}\ntype Data = Value | Values;\ntype Value = ValueType | Array<ValueType>;\ntype Values = Array<Value>;\ntype ValueType = string | ValueConfig;\ninterface ValueConfig {\n condition?: Condition;\n consent?: Consent;\n fn?: Fn;\n key?: string;\n loop?: Loop;\n map?: Map;\n set?: Value[];\n validate?: Validate;\n value?: PropertyType;\n}\ntype Condition = (value: DeepPartialEvent | unknown, mapping?: Value, collector?: Instance$2) => PromiseOrValue<boolean>;\ntype Fn = (value: DeepPartialEvent | unknown, mapping: Value, options: Options$1) => PromiseOrValue<Property | unknown>;\ntype Loop = [Value, Value];\ntype Map = {\n [key: string]: Value;\n};\ninterface Options$1 {\n consent?: Consent;\n collector?: Instance$2;\n props?: unknown;\n}\ntype Validate = (value?: unknown) => PromiseOrValue<boolean>;\n\ntype mapping_Condition = Condition;\ntype mapping_Data = Data;\ntype mapping_Fn = Fn;\ntype mapping_Loop = Loop;\ntype mapping_Map = Map;\ntype mapping_Policy = Policy;\ntype mapping_Result = Result;\ntype mapping_Rule<Settings = unknown> = Rule<Settings>;\ntype mapping_Rules<T = Rule> = Rules<T>;\ntype mapping_Validate = Validate;\ntype mapping_Value = Value;\ntype mapping_ValueConfig = ValueConfig;\ntype mapping_ValueType = ValueType;\ntype mapping_Values = Values;\ndeclare namespace mapping {\n export type { mapping_Condition as Condition, Config$2 as Config, mapping_Data as Data, mapping_Fn as Fn, mapping_Loop as Loop, mapping_Map as Map, Options$1 as Options, mapping_Policy as Policy, mapping_Result as Result, mapping_Rule as Rule, mapping_Rules as Rules, mapping_Validate as Validate, mapping_Value as Value, mapping_ValueConfig as ValueConfig, mapping_ValueType as ValueType, mapping_Values as Values };\n}\n\ntype Config$1 = {\n consent?: Array<ConsentConfig>;\n ready?: Array<ReadyConfig>;\n run?: Array<RunConfig>;\n session?: Array<SessionConfig>;\n};\ntype Types$1 = keyof Config$1;\ninterface EventContextMap {\n consent: Consent;\n session: SessionData;\n ready: undefined;\n run: undefined;\n}\ntype EventContext<T extends Types$1> = EventContextMap[T];\ntype AnyEventContext = EventContextMap[keyof EventContextMap];\ninterface Context$1 {\n consent?: Consent;\n session?: unknown;\n}\ntype Options = ConsentConfig | ReadyConfig | RunConfig | SessionConfig;\ninterface ConsentConfig {\n [key: string]: ConsentFn;\n}\ntype ConsentFn = (collector: Instance$2, consent: Consent) => void;\ntype ReadyConfig = ReadyFn;\ntype ReadyFn = (collector: Instance$2) => void;\ntype RunConfig = RunFn;\ntype RunFn = (collector: Instance$2) => void;\ntype SessionConfig = SessionFn;\ntype SessionFn = (collector: Instance$2, session?: unknown) => void;\ninterface OnConfig {\n consent?: ConsentConfig[];\n ready?: ReadyConfig[];\n run?: RunConfig[];\n session?: SessionConfig[];\n [key: string]: ConsentConfig[] | ReadyConfig[] | RunConfig[] | SessionConfig[] | undefined;\n}\ntype OnFn = <T extends Types$1>(event: T, context: EventContextMap[T]) => PromiseOrValue<void>;\ntype OnFnRuntime = (event: Types$1, context: AnyEventContext) => PromiseOrValue<void>;\n\ntype on_AnyEventContext = AnyEventContext;\ntype on_ConsentConfig = ConsentConfig;\ntype on_ConsentFn = ConsentFn;\ntype on_EventContext<T extends Types$1> = EventContext<T>;\ntype on_EventContextMap = EventContextMap;\ntype on_OnConfig = OnConfig;\ntype on_OnFn = OnFn;\ntype on_OnFnRuntime = OnFnRuntime;\ntype on_Options = Options;\ntype on_ReadyConfig = ReadyConfig;\ntype on_ReadyFn = ReadyFn;\ntype on_RunConfig = RunConfig;\ntype on_RunFn = RunFn;\ntype on_SessionConfig = SessionConfig;\ntype on_SessionFn = SessionFn;\ndeclare namespace on {\n export type { on_AnyEventContext as AnyEventContext, Config$1 as Config, on_ConsentConfig as ConsentConfig, on_ConsentFn as ConsentFn, Context$1 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$1 as Types };\n}\n\ninterface Context {\n city?: string;\n country?: string;\n encoding?: string;\n hash?: string;\n ip?: string;\n language?: string;\n origin?: string;\n region?: string;\n userAgent?: string;\n [key: string]: string | undefined;\n}\n\ntype request_Context = Context;\ndeclare namespace request {\n export type { request_Context as Context };\n}\n\ntype Contracts = Array<Contract>;\ntype Contract = {\n [entity: string]: {\n [action: string]: Properties$1;\n };\n};\ntype Properties$1 = {\n [key: string]: Property$1 | undefined;\n};\ntype Property$1 = {\n allowedKeys?: string[];\n allowedValues?: unknown[];\n maxLength?: number;\n max?: number;\n min?: number;\n required?: boolean;\n schema?: Properties$1;\n strict?: boolean;\n type?: string;\n validate?: (value: unknown, key: string, event: AnyObject) => Property;\n};\n\ntype schema_Contract = Contract;\ntype schema_Contracts = Contracts;\ndeclare namespace schema {\n export type { schema_Contract as Contract, schema_Contracts as Contracts, Properties$1 as Properties, Property$1 as Property };\n}\n\n/**\n * Base Env interface for dependency injection into sources.\n *\n * Sources receive all their dependencies through this environment object,\n * making them platform-agnostic and easily testable.\n */\ninterface BaseEnv {\n [key: string]: unknown;\n push: PushFn$1;\n command: CommandFn;\n sources?: Sources;\n elb: Fn$1;\n}\n/**\n * Type bundle for source generics.\n * Groups Settings, Mapping, Push, and Env into a single type parameter.\n *\n * @template S - Settings configuration type\n * @template M - Mapping configuration type\n * @template P - Push function signature (flexible to support HTTP handlers, etc.)\n * @template E - Environment dependencies type\n */\ninterface Types<S = unknown, M = unknown, P = Fn$1, E = BaseEnv> {\n settings: S;\n mapping: M;\n push: P;\n env: E;\n}\n/**\n * Generic constraint for Types - ensures T has required properties for indexed access\n */\ntype TypesGeneric = {\n settings: any;\n mapping: any;\n push: any;\n env: any;\n};\n/**\n * Type extractors for consistent usage with Types bundle\n */\ntype Settings<T extends TypesGeneric = Types> = T[\'settings\'];\ntype Mapping<T extends TypesGeneric = Types> = T[\'mapping\'];\ntype Push<T extends TypesGeneric = Types> = T[\'push\'];\ntype Env<T extends TypesGeneric = Types> = T[\'env\'];\n/**\n * Inference helper: Extract Types from Instance\n */\ntype TypesOf<I> = I extends Instance<infer T> ? T : never;\ninterface Config<T extends TypesGeneric = Types> extends Config$2<Mapping<T>> {\n settings?: Settings<T>;\n env?: Env<T>;\n id?: string;\n onError?: Error;\n disabled?: boolean;\n primary?: boolean;\n}\ntype PartialConfig<T extends TypesGeneric = Types> = Config<Types<Partial<Settings<T>> | Settings<T>, Partial<Mapping<T>> | Mapping<T>, Push<T>, Env<T>>>;\ninterface Instance<T extends TypesGeneric = Types> {\n type: string;\n config: Config<T>;\n push: Push<T>;\n destroy?(): void | Promise<void>;\n on?(event: Types$1, context?: unknown): void | Promise<void>;\n}\ntype Init<T extends TypesGeneric = Types> = (config: Partial<Config<T>>, env: Env<T>) => Instance<T> | Promise<Instance<T>>;\ntype InitSource<T extends TypesGeneric = Types> = {\n code: Init<T>;\n config?: Partial<Config<T>>;\n env?: Partial<Env<T>>;\n primary?: boolean;\n};\n/**\n * Sources configuration for collector.\n * Maps source IDs to their initialization configurations.\n */\ninterface InitSources {\n [sourceId: string]: InitSource<any>;\n}\n\ntype source_BaseEnv = BaseEnv;\ntype source_Config<T extends TypesGeneric = Types> = Config<T>;\ntype source_Env<T extends TypesGeneric = Types> = Env<T>;\ntype source_Init<T extends TypesGeneric = Types> = Init<T>;\ntype source_InitSource<T extends TypesGeneric = Types> = InitSource<T>;\ntype source_InitSources = InitSources;\ntype source_Instance<T extends TypesGeneric = Types> = Instance<T>;\ntype source_Mapping<T extends TypesGeneric = Types> = Mapping<T>;\ntype source_PartialConfig<T extends TypesGeneric = Types> = PartialConfig<T>;\ntype source_Push<T extends TypesGeneric = Types> = Push<T>;\ntype source_Settings<T extends TypesGeneric = Types> = Settings<T>;\ntype source_Types<S = unknown, M = unknown, P = Fn$1, E = BaseEnv> = Types<S, M, P, E>;\ntype source_TypesGeneric = TypesGeneric;\ntype source_TypesOf<I> = TypesOf<I>;\ndeclare namespace source {\n export type { source_BaseEnv as BaseEnv, source_Config as Config, source_Env as Env, source_Init as Init, source_InitSource as InitSource, source_InitSources as InitSources, source_Instance as Instance, source_Mapping as Mapping, source_PartialConfig as PartialConfig, source_Push as Push, source_Settings as Settings, source_Types as Types, source_TypesGeneric as TypesGeneric, source_TypesOf as TypesOf };\n}\n\ntype AnyObject<T = unknown> = Record<string, T>;\ntype Elb = Fn$1;\ntype AnyFunction = (...args: unknown[]) => unknown;\ntype SingleOrArray<T> = T | Array<T>;\ntype Events = Array<Event>;\ntype PartialEvent = Partial<Event>;\ntype DeepPartialEvent = DeepPartial<Event>;\ninterface Event {\n name: string;\n data: Properties;\n context: OrderedProperties;\n globals: Properties;\n custom: Properties;\n user: User;\n nested: Entities;\n consent: Consent;\n id: string;\n trigger: string;\n entity: string;\n action: string;\n timestamp: number;\n timing: number;\n group: string;\n count: number;\n version: Version;\n source: Source;\n}\ninterface Consent {\n [name: string]: boolean;\n}\ninterface User extends Properties {\n id?: string;\n device?: string;\n session?: string;\n hash?: string;\n address?: string;\n email?: string;\n phone?: string;\n userAgent?: string;\n browser?: string;\n browserVersion?: string;\n deviceType?: string;\n language?: string;\n country?: string;\n region?: string;\n city?: string;\n zip?: string;\n timezone?: string;\n os?: string;\n osVersion?: string;\n screenSize?: string;\n ip?: string;\n internal?: boolean;\n}\ninterface Version extends Properties {\n source: string;\n tagging: number;\n}\ninterface Source extends Properties {\n type: SourceType;\n id: string;\n previous_id: string;\n}\ntype SourceType = \'web\' | \'server\' | \'app\' | \'other\' | string;\ntype PropertyType = boolean | string | number | {\n [key: string]: Property;\n};\ntype Property = PropertyType | Array<PropertyType>;\ninterface Properties {\n [key: string]: Property | undefined;\n}\ninterface OrderedProperties {\n [key: string]: [Property, number] | undefined;\n}\ntype Entities = Array<Entity>;\ninterface Entity {\n entity: string;\n data: Properties;\n nested: Entities;\n context: OrderedProperties;\n}\ntype ConsentHandler = Record<string, AnyFunction>;\ntype ActionHandler = AnyFunction;\ntype DeepPartial<T> = {\n [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];\n};\ntype PromiseOrValue<T> = T | Promise<T>;\n\ntype walkeros_ActionHandler = ActionHandler;\ntype walkeros_AnyFunction = AnyFunction;\ntype walkeros_AnyObject<T = unknown> = AnyObject<T>;\ntype walkeros_Consent = Consent;\ntype walkeros_ConsentHandler = ConsentHandler;\ntype walkeros_DeepPartial<T> = DeepPartial<T>;\ntype walkeros_DeepPartialEvent = DeepPartialEvent;\ntype walkeros_Elb = Elb;\ntype walkeros_Entities = Entities;\ntype walkeros_Entity = Entity;\ntype walkeros_Event = Event;\ntype walkeros_Events = Events;\ntype walkeros_OrderedProperties = OrderedProperties;\ntype walkeros_PartialEvent = PartialEvent;\ntype walkeros_PromiseOrValue<T> = PromiseOrValue<T>;\ntype walkeros_Properties = Properties;\ntype walkeros_Property = Property;\ntype walkeros_PropertyType = PropertyType;\ntype walkeros_SingleOrArray<T> = SingleOrArray<T>;\ntype walkeros_Source = Source;\ntype walkeros_SourceType = SourceType;\ntype walkeros_User = User;\ntype walkeros_Version = Version;\ndeclare namespace walkeros {\n export type { walkeros_ActionHandler as ActionHandler, walkeros_AnyFunction as AnyFunction, walkeros_AnyObject as AnyObject, walkeros_Consent as Consent, walkeros_ConsentHandler as ConsentHandler, walkeros_DeepPartial as DeepPartial, walkeros_DeepPartialEvent as DeepPartialEvent, walkeros_Elb as Elb, walkeros_Entities as Entities, walkeros_Entity as Entity, walkeros_Event as Event, walkeros_Events as Events, walkeros_OrderedProperties as OrderedProperties, walkeros_PartialEvent as PartialEvent, walkeros_PromiseOrValue as PromiseOrValue, walkeros_Properties as Properties, walkeros_Property as Property, walkeros_PropertyType as PropertyType, walkeros_SingleOrArray as SingleOrArray, walkeros_Source as Source, walkeros_SourceType as SourceType, walkeros_User as User, walkeros_Version as Version };\n}\n\ntype StorageType = \'local\' | \'session\' | \'cookie\';\ndeclare const Const: {\n readonly Utils: {\n readonly Storage: {\n readonly Local: "local";\n readonly Session: "session";\n readonly Cookie: "cookie";\n };\n };\n};\n\ntype SendDataValue = Property | Properties;\ntype SendHeaders = {\n [key: string]: string;\n};\ninterface SendResponse {\n ok: boolean;\n data?: unknown;\n error?: string;\n}\n\n/**\n * Anonymizes an IPv4 address by setting the last octet to 0.\n *\n * @param ip The IP address to anonymize.\n * @returns The anonymized IP address or an empty string if the IP is invalid.\n */\ndeclare function anonymizeIP(ip: string): string;\n\n/**\n * @interface Assign\n * @description Options for the assign function.\n * @property merge - Merge array properties instead of overriding them.\n * @property shallow - Create a shallow copy instead of updating the target object.\n * @property extend - Extend the target with new properties instead of only updating existing ones.\n */\ninterface Assign {\n merge?: boolean;\n shallow?: boolean;\n extend?: boolean;\n}\n/**\n * Merges objects with advanced options.\n *\n * @template T, U\n * @param target - The target object to merge into.\n * @param obj - The source object to merge from.\n * @param options - Options for merging.\n * @returns The merged object.\n */\ndeclare function assign<T extends object, U extends object>(target: T, obj?: U, options?: Assign): T & U;\n\n/**\n * Gets a value from an object by a dot-notation string.\n * Supports wildcards for arrays.\n *\n * @example\n * getByPath({ data: { id: 1 } }, "data.id") // Returns 1\n *\n * @param event - The object to get the value from.\n * @param key - The dot-notation string.\n * @param defaultValue - The default value to return if the key is not found.\n * @returns The value from the object or the default value.\n */\ndeclare function getByPath(event: unknown, key?: string, defaultValue?: unknown): unknown;\n/**\n * Sets a value in an object by a dot-notation string.\n *\n * @param obj - The object to set the value in.\n * @param key - The dot-notation string.\n * @param value - The value to set.\n * @returns A new object with the updated value.\n */\ndeclare function setByPath<T = unknown>(obj: T, key: string, value: unknown): T;\n\n/**\n * Casts a value to a specific type.\n *\n * @param value The value to cast.\n * @returns The casted value.\n */\ndeclare function castValue(value: unknown): PropertyType;\n\n/**\n * Creates a deep clone of a value.\n * Supports primitive values, objects, arrays, dates, and regular expressions.\n * Handles circular references.\n *\n * @template T\n * @param org - The value to clone.\n * @param visited - A map of visited objects to handle circular references.\n * @returns The cloned value.\n */\ndeclare function clone<T>(org: T, visited?: WeakMap<object, unknown>): T;\n\n/**\n * Checks if the required consent is granted.\n *\n * @param required - The required consent states.\n * @param state - The current consent states.\n * @param individual - Individual consent states to prioritize.\n * @returns The granted consent states or false if not granted.\n */\ndeclare function getGrantedConsent(required: Consent | undefined, state?: Consent, individual?: Consent): false | Consent;\n\n/**\n * Creates a new destination instance by merging a base destination with additional configuration.\n *\n * This utility enables elegant destination configuration while avoiding config side-effects\n * that could occur when reusing destination objects across multiple collector instances.\n *\n * @param baseDestination - The base destination to extend\n * @param config - Additional configuration to merge with the base destination\'s config\n * @returns A new destination instance with merged configuration\n *\n * @example\n * ```typescript\n * // Types are inferred automatically from destinationGtag\n * elb(\'walker destination\', createDestination(destinationGtag, {\n * settings: { ga4: { measurementId: \'G-123\' } }\n * }));\n * ```\n */\ndeclare function createDestination<I extends Instance$1>(baseDestination: I, config: Partial<Config$4<TypesOf$1<I>>>): I;\n\n/**\n * Creates a complete event with default values.\n * Used for testing and debugging.\n *\n * @param props - Properties to override the default values.\n * @returns A complete event.\n */\ndeclare function createEvent(props?: DeepPartialEvent): Event;\n/**\n * Creates a complete event with default values based on the event name.\n * Used for testing and debugging.\n *\n * @param name - The name of the event to create.\n * @param props - Properties to override the default values.\n * @returns A complete event.\n */\ndeclare function getEvent(name?: string, props?: DeepPartialEvent): Event;\n\n/**\n * Generates a random string of a given length.\n *\n * @param length - The length of the random string.\n * @returns The random string.\n */\ndeclare function getId(length?: number): string;\n\ninterface MarketingParameters {\n [key: string]: string;\n}\n/**\n * Extracts marketing parameters from a URL.\n *\n * @param url - The URL to extract the parameters from.\n * @param custom - Custom marketing parameters to extract.\n * @returns The extracted marketing parameters.\n */\ndeclare function getMarketingParameters(url: URL, custom?: MarketingParameters): Properties;\n\n/**\n * Creates a debounced function that delays invoking `fn` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `fn` invocations and a `flush` method to immediately invoke them.\n *\n * @template P, R\n * @param fn The function to debounce.\n * @param wait The number of milliseconds to delay.\n * @param immediate Trigger the function on the leading edge, instead of the trailing.\n * @returns The new debounced function.\n */\ndeclare function debounce<P extends unknown[], R>(fn: (...args: P) => R, wait?: number, immediate?: boolean): (...args: P) => Promise<R>;\ndeclare function throttle<P extends unknown[], R>(fn: (...args: P) => R | undefined, delay?: number): (...args: P) => R | undefined;\n\n/**\n * Checks if a value is an arguments object.\n *\n * @param value The value to check.\n * @returns True if the value is an arguments object, false otherwise.\n */\ndeclare function isArguments(value: unknown): value is IArguments;\n/**\n * Checks if a value is an array.\n *\n * @param value The value to check.\n * @returns True if the value is an array, false otherwise.\n */\ndeclare function isArray<T>(value: unknown): value is T[];\n/**\n * Checks if a value is a boolean.\n *\n * @param value The value to check.\n * @returns True if the value is a boolean, false otherwise.\n */\ndeclare function isBoolean(value: unknown): value is boolean;\n/**\n * Checks if an entity is a walker command.\n *\n * @param entity The entity to check.\n * @returns True if the entity is a walker command, false otherwise.\n */\ndeclare function isCommand(entity: string): entity is "walker";\n/**\n * Checks if a value is defined.\n *\n * @param value The value to check.\n * @returns True if the value is defined, false otherwise.\n */\ndeclare function isDefined<T>(val: T | undefined): val is T;\n/**\n * Checks if a value is an element or the document.\n *\n * @param elem The value to check.\n * @returns True if the value is an element or the document, false otherwise.\n */\ndeclare function isElementOrDocument(elem: unknown): elem is Element;\n/**\n * Checks if a value is a function.\n *\n * @param value The value to check.\n * @returns True if the value is a function, false otherwise.\n */\ndeclare function isFunction(value: unknown): value is Function;\n/**\n * Checks if a value is a number.\n *\n * @param value The value to check.\n * @returns True if the value is a number, false otherwise.\n */\ndeclare function isNumber(value: unknown): value is number;\n/**\n * Checks if a value is an object.\n *\n * @param value The value to check.\n * @returns True if the value is an object, false otherwise.\n */\ndeclare function isObject(value: unknown): value is AnyObject;\n/**\n * Checks if two variables have the same type.\n *\n * @param variable The first variable.\n * @param type The second variable.\n * @returns True if the variables have the same type, false otherwise.\n */\ndeclare function isSameType<T>(variable: unknown, type: T): variable is typeof type;\n/**\n * Checks if a value is a string.\n *\n * @param value The value to check.\n * @returns True if the value is a string, false otherwise.\n */\ndeclare function isString(value: unknown): value is string;\n\n/**\n * Gets the mapping for an event.\n *\n * @param event The event to get the mapping for (can be partial or full).\n * @param mapping The mapping rules.\n * @returns The mapping result.\n */\ndeclare function getMappingEvent(event: DeepPartialEvent | PartialEvent | Event, mapping?: Rules): Promise<Result>;\n/**\n * Gets a value from a mapping.\n *\n * @param value The value to get the mapping from.\n * @param data The mapping data.\n * @param options The mapping options.\n * @returns The mapped value.\n */\ndeclare function getMappingValue(value: DeepPartialEvent | unknown | undefined, data?: Data, options?: Options$1): Promise<Property | undefined>;\n/**\n * Processes an event through mapping configuration.\n *\n * This is the unified mapping logic used by both sources and destinations.\n * It applies transformations in this order:\n * 1. Config-level policy - modifies the event itself (global rules)\n * 2. Mapping rules - finds matching rule based on entity-action\n * 3. Event-level policy - modifies the event based on specific mapping rule\n * 4. Data transformation - creates context data\n * 5. Ignore check and name override\n *\n * Sources can pass partial events, destinations pass full events.\n * getMappingValue works with both partial and full events.\n *\n * @param event - The event to process (can be partial or full, will be mutated by policies)\n * @param config - Mapping configuration (mapping, data, policy, consent)\n * @param collector - Collector instance for context\n * @returns Object with transformed event, data, mapping rule, and ignore flag\n */\ndeclare function processEventMapping<T extends DeepPartialEvent | Event>(event: T, config: Config$2, collector: Instance$2): Promise<{\n event: T;\n data?: Property;\n mapping?: Rule;\n mappingKey?: string;\n ignore: boolean;\n}>;\n\n/**\n * Environment mocking utilities for walkerOS destinations\n *\n * Provides standardized tools for intercepting function calls in environment objects,\n * enabling consistent testing patterns across all destinations.\n */\ntype InterceptorFn = (path: string[], args: unknown[], original?: Function) => unknown;\n/**\n * Creates a proxied environment that intercepts function calls\n *\n * Uses Proxy to wrap environment objects and capture all function calls,\n * allowing for call recording, mocking, or simulation.\n *\n * @param env - The environment object to wrap\n * @param interceptor - Function called for each intercepted call\n * @returns Proxied environment with interceptor applied\n *\n * @example\n * ```typescript\n * const calls: Array<{ path: string[]; args: unknown[] }> = [];\n *\n * const testEnv = mockEnv(env.push, (path, args) => {\n * calls.push({ path, args });\n * });\n *\n * // Use testEnv with destination\n * await destination.push(event, { env: testEnv });\n *\n * // Analyze captured calls\n * expect(calls).toContainEqual({\n * path: [\'window\', \'gtag\'],\n * args: [\'event\', \'purchase\', { value: 99.99 }]\n * });\n * ```\n */\ndeclare function mockEnv<T extends object>(env: T, interceptor: InterceptorFn): T;\n/**\n * Traverses environment object and replaces values using a replacer function\n *\n * Alternative to mockEnv for environments where Proxy is not suitable.\n * Performs deep traversal and allows value transformation at each level.\n *\n * @param env - The environment object to traverse\n * @param replacer - Function to transform values during traversal\n * @returns New environment object with transformed values\n *\n * @example\n * ```typescript\n * const recordedCalls: APICall[] = [];\n *\n * const recordingEnv = traverseEnv(originalEnv, (value, path) => {\n * if (typeof value === \'function\') {\n * return (...args: unknown[]) => {\n * recordedCalls.push({\n * path: path.join(\'.\'),\n * args: structuredClone(args)\n * });\n * return value(...args);\n * };\n * }\n * return value;\n * });\n * ```\n */\ndeclare function traverseEnv<T extends object>(env: T, replacer: (value: unknown, path: string[]) => unknown): T;\n\n/**\n * Logs a message to the console if verbose logging is enabled.\n *\n * @param message The message to log.\n * @param verbose Whether to log the message.\n */\ndeclare function onLog(message: unknown, verbose?: boolean): void;\n\n/**\n * Checks if a value is a valid property type.\n *\n * @param value The value to check.\n * @returns True if the value is a valid property type, false otherwise.\n */\ndeclare function isPropertyType(value: unknown): value is PropertyType;\n/**\n * Filters a value to only include valid property types.\n *\n * @param value The value to filter.\n * @returns The filtered value or undefined.\n */\ndeclare function filterValues(value: unknown): Property | undefined;\n/**\n * Casts a value to a valid property type.\n *\n * @param value The value to cast.\n * @returns The casted value or undefined.\n */\ndeclare function castToProperty(value: unknown): Property | undefined;\n\n/**\n * Converts a request string to a data object.\n *\n * @param parameter The request string to convert.\n * @returns The data object or undefined.\n */\ndeclare function requestToData(parameter: unknown): AnyObject | undefined;\n/**\n * Converts a data object to a request string.\n *\n * @param data The data object to convert.\n * @returns The request string.\n */\ndeclare function requestToParameter(data: AnyObject | PropertyType): string;\n\n/**\n * Transforms data to a string.\n *\n * @param data The data to transform.\n * @returns The transformed data.\n */\ndeclare function transformData(data?: SendDataValue): string | undefined;\n/**\n * Gets the headers for a request.\n *\n * @param headers The headers to merge with the default headers.\n * @returns The merged headers.\n */\ndeclare function getHeaders(headers?: SendHeaders): SendHeaders;\n\n/**\n * Throws an error.\n *\n * @param error The error to throw.\n */\ndeclare function throwError(error: unknown): never;\n\n/**\n * Trims quotes and whitespaces from a string.\n *\n * @param str The string to trim.\n * @returns The trimmed string.\n */\ndeclare function trim(str: string): string;\n\n/**\n * A utility function that wraps a function in a try-catch block.\n *\n * @template P, R, S\n * @param fn The function to wrap.\n * @param onError A function to call when an error is caught.\n * @param onFinally A function to call in the finally block.\n * @returns The wrapped function.\n */\ndeclare function tryCatch<P extends unknown[], R, S>(fn: (...args: P) => R | undefined, onError: (err: unknown) => S, onFinally?: () => void): (...args: P) => R | S;\ndeclare function tryCatch<P extends unknown[], R>(fn: (...args: P) => R | undefined, onError?: undefined, onFinally?: () => void): (...args: P) => R | undefined;\n/**\n * A utility function that wraps an async function in a try-catch block.\n *\n * @template P, R, S\n * @param fn The async function to wrap.\n * @param onError A function to call when an error is caught.\n * @param onFinally A function to call in the finally block.\n * @returns The wrapped async function.\n */\ndeclare function tryCatchAsync<P extends unknown[], R, S>(fn: (...args: P) => R, onError: (err: unknown) => S, onFinally?: () => void | Promise<void>): (...args: P) => Promise<R | S>;\ndeclare function tryCatchAsync<P extends unknown[], R>(fn: (...args: P) => R, onError?: undefined, onFinally?: () => void | Promise<void>): (...args: P) => Promise<R | undefined>;\n\n/**\n * A utility function that wraps a function with hooks.\n *\n * @template P, R\n * @param fn The function to wrap.\n * @param name The name of the function.\n * @param hooks The hooks to use.\n * @returns The wrapped function.\n */\ndeclare function useHooks<P extends unknown[], R>(fn: (...args: P) => R, name: string, hooks: Functions): (...args: P) => R;\n\n/**\n * Parses a user agent string to extract browser, OS, and device information.\n *\n * @param userAgent The user agent string to parse.\n * @returns An object containing the parsed user agent information.\n */\ndeclare function parseUserAgent(userAgent?: string): User;\n/**\n * Gets the browser name from a user agent string.\n *\n * @param userAgent The user agent string.\n * @returns The browser name or undefined.\n */\ndeclare function getBrowser(userAgent: string): string | undefined;\n/**\n * Gets the browser version from a user agent string.\n *\n * @param userAgent The user agent string.\n * @returns The browser version or undefined.\n */\ndeclare function getBrowserVersion(userAgent: string): string | undefined;\n/**\n * Gets the OS name from a user agent string.\n *\n * @param userAgent The user agent string.\n * @returns The OS name or undefined.\n */\ndeclare function getOS(userAgent: string): string | undefined;\n/**\n * Gets the OS version from a user agent string.\n *\n * @param userAgent The user agent string.\n * @returns The OS version or undefined.\n */\ndeclare function getOSVersion(userAgent: string): string | undefined;\n/**\n * Gets the device type from a user agent string.\n *\n * @param userAgent The user agent string.\n * @returns The device type or undefined.\n */\ndeclare function getDeviceType(userAgent: string): string | undefined;\n\n/**\n * Validates an event against a set of contracts.\n *\n * @param obj The event to validate.\n * @param customContracts The custom contracts to use.\n * @returns The validated event.\n */\ndeclare function validateEvent(obj: unknown, customContracts?: Contracts): Event | never;\n/**\n * Validates a property against a schema.\n *\n * @param obj The object to validate.\n * @param key The key of the property to validate.\n * @param value The value of the property to validate.\n * @param schema The schema to validate against.\n * @returns The validated property.\n */\ndeclare function validateProperty(obj: AnyObject, key: string, value: unknown, schema: Property$1): Property | never;\n\nexport { collector as Collector, Const, data as Data, destination as Destination, elb as Elb, flow as Flow, handler as Handler, hooks as Hooks, mapping as Mapping, type MarketingParameters, on as On, request as Request, schema as Schema, type SendDataValue, type SendHeaders, type SendResponse, source as Source, type StorageType, walkeros as WalkerOS, anonymizeIP, assign, castToProperty, castValue, clone, createDestination, createEvent, debounce, filterValues, getBrowser, getBrowserVersion, getByPath, getDeviceType, getEvent, getGrantedConsent, getHeaders, getId, getMappingEvent, getMappingValue, getMarketingParameters, getOS, getOSVersion, isArguments, isArray, isBoolean, isCommand, isDefined, isElementOrDocument, isFunction, isNumber, isObject, isPropertyType, isSameType, isString, mockEnv, onLog, parseUserAgent, processEventMapping, requestToData, requestToParameter, setByPath, throttle, throwError, transformData, traverseEnv, trim, tryCatch, tryCatchAsync, useHooks, validateEvent, validateProperty };\n';
398
+
399
+ // src/utils/monaco-types.ts
400
+ var typeLibraries = /* @__PURE__ */ new Map();
401
+ function configureMonacoTypeScript(monaco) {
402
+ monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
403
+ target: monaco.languages.typescript.ScriptTarget.ES2020,
404
+ lib: ["es2020"],
405
+ allowNonTsExtensions: true,
406
+ moduleResolution: monaco.languages.typescript.ModuleResolutionKind.NodeJs,
407
+ module: monaco.languages.typescript.ModuleKind.CommonJS,
408
+ noEmit: true,
409
+ esModuleInterop: true,
410
+ jsx: monaco.languages.typescript.JsxEmit.React,
411
+ allowJs: true,
412
+ checkJs: false,
413
+ strict: false,
414
+ noImplicitAny: false,
415
+ strictNullChecks: false
416
+ });
417
+ monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
418
+ noSemanticValidation: false,
419
+ noSyntaxValidation: false,
420
+ diagnosticCodesToIgnore: [
421
+ 1108,
422
+ 1005
423
+ ]
424
+ });
425
+ monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
426
+ target: monaco.languages.typescript.ScriptTarget.ES2020,
427
+ lib: ["es2020"],
428
+ allowNonTsExtensions: true,
429
+ moduleResolution: monaco.languages.typescript.ModuleResolutionKind.NodeJs,
430
+ module: monaco.languages.typescript.ModuleKind.CommonJS,
431
+ noEmit: true,
432
+ esModuleInterop: true,
433
+ jsx: monaco.languages.typescript.JsxEmit.React,
434
+ strict: false
435
+ });
436
+ }
437
+ function addTypeLibrary(monaco, uri, content) {
438
+ if (typeLibraries.has(uri)) {
439
+ return false;
440
+ }
441
+ const jsDisposable = monaco.languages.typescript.javascriptDefaults.addExtraLib(
442
+ content,
443
+ uri
444
+ );
445
+ const tsDisposable = monaco.languages.typescript.typescriptDefaults.addExtraLib(
446
+ content,
447
+ uri
448
+ );
449
+ typeLibraries.set(uri, {
450
+ uri,
451
+ content,
452
+ disposable: {
453
+ dispose: () => {
454
+ jsDisposable.dispose();
455
+ tsDisposable.dispose();
456
+ }
457
+ }
458
+ });
459
+ return true;
460
+ }
461
+ function removeTypeLibrary(uri) {
462
+ const lib = typeLibraries.get(uri);
463
+ if (!lib) {
464
+ return false;
465
+ }
466
+ lib.disposable?.dispose();
467
+ typeLibraries.delete(uri);
468
+ return true;
469
+ }
470
+ function updateTypeLibrary(monaco, uri, content) {
471
+ removeTypeLibrary(uri);
472
+ addTypeLibrary(monaco, uri, content);
473
+ }
474
+ async function loadTypeLibraryFromURL(monaco, url, uri) {
475
+ try {
476
+ const response = await fetch(url);
477
+ if (!response.ok) {
478
+ return false;
479
+ }
480
+ const content = await response.text();
481
+ const typeUri = uri || `file:///${url}`;
482
+ return addTypeLibrary(monaco, typeUri, content);
483
+ } catch {
484
+ return false;
485
+ }
486
+ }
487
+ function stripExternalImports(content) {
488
+ let cleaned = content.replace(
489
+ /^import\s+(?:type\s+)?(?:\*\s+as\s+\w+|\{[^}]*\}|[\w$]+)(?:\s*,\s*(?:\{[^}]*\}|\*\s+as\s+\w+))?\s+from\s+['"][^'"]+['"];?\s*$/gm,
490
+ ""
491
+ );
492
+ cleaned = cleaned.replace(
493
+ /^import\s+(?:type\s+)?(?:\{[^}]*\}|\*\s+as\s+\w+|[\w$]+)\s+from\s+['"][^'"]+['"];?\s*$/gms,
494
+ ""
495
+ );
496
+ cleaned = cleaned.replace(
497
+ /import\s*\(\s*['"][^'"]+['"]\s*\)/g,
498
+ "any"
499
+ );
500
+ cleaned = cleaned.replace(/\n{3,}/g, "\n\n");
501
+ return cleaned;
502
+ }
503
+ async function loadPackageTypes(monaco, options) {
504
+ const { package: packageName, version = "latest" } = options;
505
+ const uri = `file:///node_modules/${packageName}/index.d.ts`;
506
+ if (typeLibraries.has(uri)) {
507
+ return true;
508
+ }
509
+ const url = `https://cdn.jsdelivr.net/npm/${packageName}@${version}/dist/index.d.ts`;
510
+ try {
511
+ const response = await fetch(url);
512
+ if (!response.ok) {
513
+ console.warn(`Failed to load types for ${packageName}@${version}: ${response.status}`);
514
+ return false;
515
+ }
516
+ let content = await response.text();
517
+ content = stripExternalImports(content);
518
+ const moduleContent = `declare module '${packageName}' {
519
+ ${content}
520
+ }`;
521
+ const success = addTypeLibrary(monaco, uri, moduleContent);
522
+ return success;
523
+ } catch (error) {
524
+ console.error(`Error loading types for ${packageName}:`, error);
525
+ return false;
526
+ }
527
+ }
528
+ function loadWalkerOSCoreTypes(monaco) {
529
+ const uri = "file:///node_modules/@walkeros/core/index.d.ts";
530
+ if (typeLibraries.has(uri)) {
531
+ return true;
532
+ }
533
+ const cleanedTypes = stripExternalImports(virtual_walkeros_core_types_default);
534
+ const moduleContent = `declare module '@walkeros/core' {
535
+ ${cleanedTypes}
536
+ }`;
537
+ return addTypeLibrary(monaco, uri, moduleContent);
538
+ }
539
+ function addFunctionContextTypes(monaco, context) {
540
+ const uri = `file:///context/${context.type}.d.ts`;
541
+ const contextTypes = getContextTypes(context.type);
542
+ updateTypeLibrary(monaco, uri, contextTypes);
543
+ }
544
+ function addDestinationType(monaco, destinationId, typeDefinition) {
545
+ const uri = `file:///destinations/${destinationId}.d.ts`;
546
+ updateTypeLibrary(monaco, uri, typeDefinition);
547
+ }
548
+ function removeDestinationType(destinationId) {
549
+ const uri = `file:///destinations/${destinationId}.d.ts`;
550
+ removeTypeLibrary(uri);
551
+ }
552
+ function registerWalkerOSTypes(monaco) {
553
+ configureMonacoTypeScript(monaco);
554
+ loadWalkerOSCoreTypes(monaco);
555
+ }
556
+ function initializeMonacoTypes(monaco) {
557
+ configureMonacoTypeScript(monaco);
558
+ loadWalkerOSCoreTypes(monaco);
559
+ addFunctionContextTypes(monaco, { type: "condition" });
560
+ }
561
+ function getLoadedTypeLibraries() {
562
+ return Array.from(typeLibraries.keys());
563
+ }
564
+ function clearAllTypeLibraries() {
565
+ for (const [uri, lib] of typeLibraries.entries()) {
566
+ lib.disposable?.dispose();
567
+ }
568
+ typeLibraries.clear();
569
+ }
570
+
571
+ export {
572
+ configureMonacoTypeScript,
573
+ addTypeLibrary,
574
+ removeTypeLibrary,
575
+ updateTypeLibrary,
576
+ loadTypeLibraryFromURL,
577
+ loadPackageTypes,
578
+ loadWalkerOSCoreTypes,
579
+ addFunctionContextTypes,
580
+ addDestinationType,
581
+ removeDestinationType,
582
+ registerWalkerOSTypes,
583
+ initializeMonacoTypes,
584
+ getLoadedTypeLibraries,
585
+ clearAllTypeLibraries
586
+ };
587
+ //# sourceMappingURL=chunk-BEAIHYJ5.mjs.map