posthog-js 1.428.7 → 1.428.9

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.
Files changed (60) hide show
  1. package/LICENSE +64 -0
  2. package/dist/all-external-dependencies.js +1 -1
  3. package/dist/all-external-dependencies.js.map +1 -1
  4. package/dist/array.full.es5.js +1 -1
  5. package/dist/array.full.es5.js.map +1 -1
  6. package/dist/array.full.js +1 -1
  7. package/dist/array.full.js.map +1 -1
  8. package/dist/array.full.no-external.js +1 -1
  9. package/dist/array.full.no-external.js.map +1 -1
  10. package/dist/array.js +1 -1
  11. package/dist/array.js.map +1 -1
  12. package/dist/array.no-external.js +1 -1
  13. package/dist/array.no-external.js.map +1 -1
  14. package/dist/customizations.d.ts +1 -0
  15. package/dist/customizations.full.js +1 -1
  16. package/dist/customizations.js +1 -1
  17. package/dist/default-extensions.js +1 -1
  18. package/dist/default-extensions.js.map +1 -1
  19. package/dist/exception-autocapture.js +1 -1
  20. package/dist/exception-autocapture.js.map +1 -1
  21. package/dist/extension-bundles.js +1 -1
  22. package/dist/extension-bundles.js.map +1 -1
  23. package/dist/lazy-recorder.js +1 -1
  24. package/dist/lazy-recorder.js.map +1 -1
  25. package/dist/main.d.ts +1 -0
  26. package/dist/main.js +1 -1
  27. package/dist/main.js.map +1 -1
  28. package/dist/module.d.ts +1 -0
  29. package/dist/module.full.d.ts +1 -0
  30. package/dist/module.full.js +1 -1
  31. package/dist/module.full.js.map +1 -1
  32. package/dist/module.full.no-external.d.ts +1 -0
  33. package/dist/module.full.no-external.js +1 -1
  34. package/dist/module.full.no-external.js.map +1 -1
  35. package/dist/module.js +1 -1
  36. package/dist/module.js.map +1 -1
  37. package/dist/module.mjs +1 -1
  38. package/dist/module.mjs.map +1 -1
  39. package/dist/module.no-external.d.ts +1 -0
  40. package/dist/module.no-external.js +1 -1
  41. package/dist/module.no-external.js.map +1 -1
  42. package/dist/module.slim.js +1 -1
  43. package/dist/module.slim.no-external.d.ts +1 -0
  44. package/dist/module.slim.no-external.js +1 -1
  45. package/dist/posthog-recorder.d.ts +577 -653
  46. package/dist/posthog-recorder.js +1 -1
  47. package/dist/posthog-recorder.js.map +1 -1
  48. package/dist/recorder.d.ts +577 -653
  49. package/dist/rrweb-plugin-console-record.d.ts +436 -500
  50. package/dist/rrweb-types.d.ts +688 -735
  51. package/dist/rrweb.d.ts +1303 -1433
  52. package/dist/src/entrypoints/rrweb-types.es.d.ts +9 -0
  53. package/dist/src/extensions/replay/types/rrweb-types.d.ts +1 -0
  54. package/lib/package.json +10 -4
  55. package/lib/src/entrypoints/rrweb-types.es.d.ts +9 -0
  56. package/lib/src/extensions/replay/external/lazy-loaded-session-recorder.js +12 -2
  57. package/lib/src/extensions/replay/external/lazy-loaded-session-recorder.js.map +1 -1
  58. package/lib/src/extensions/replay/types/rrweb-types.d.ts +1 -0
  59. package/lib/src/extensions/replay/types/rrweb-types.js.map +1 -1
  60. package/package.json +16 -10
package/dist/rrweb.d.ts CHANGED
@@ -1,1004 +1,937 @@
1
- declare type actionWithDelay = {
2
- doAction: () => void;
3
- delay: number;
4
- };
5
-
6
- declare type addedNodeMutation = {
7
- parentId: number;
8
- previousId?: number | null;
9
- nextId: number | null;
10
- node: serializedNodeWithId;
11
- };
12
-
13
- declare type adoptedStyleSheetData = {
14
- source: IncrementalSource.AdoptedStyleSheet;
15
- } & adoptedStyleSheetParam;
16
-
17
- declare type adoptedStyleSheetParam = {
18
- id: number;
19
- styles?: {
20
- styleId: number;
21
- rules: styleSheetAddRule[];
22
- }[];
23
- styleIds: number[];
24
- };
25
-
26
- declare type attributeMutation = {
27
- id: number;
28
- attributes: {
29
- [key: string]: string | styleOMValue | null;
30
- };
31
- };
32
-
33
- declare type attributes = cssTextKeyAttr & {
34
- [key: string]: string | number | true | null;
35
- };
36
-
37
- declare type blockClass = string | RegExp;
38
-
39
- declare enum CanvasContext {
40
- '2D' = 0,
41
- WebGL = 1,
42
- WebGL2 = 2
43
- }
44
-
45
- declare type canvasEventWithTime = eventWithTime & {
46
- type: EventType.IncrementalSnapshot;
47
- data: canvasMutationData;
48
- };
49
-
50
- declare type CanvasMasking = {
51
- regionsFn?: (canvas: HTMLCanvasElement) => CanvasMaskRegion[] | null | undefined;
52
- configured?: () => boolean;
53
- };
54
-
55
- declare type CanvasMaskRegion = {
56
- x: number;
57
- y: number;
58
- width: number;
59
- height: number;
60
- };
61
-
62
- declare type canvasMutationCallback = (p: canvasMutationParam) => void;
63
-
64
- declare type canvasMutationCommand = {
65
- property: string;
66
- args: Array<unknown>;
67
- setter?: true;
68
- };
69
-
70
- declare type canvasMutationData = {
71
- source: IncrementalSource.CanvasMutation;
72
- } & canvasMutationParam;
73
-
74
- declare type canvasMutationParam = {
75
- id: number;
76
- type: CanvasContext;
77
- commands: canvasMutationCommand[];
78
- displayWidth?: number;
79
- displayHeight?: number;
80
- } | ({
81
- id: number;
82
- type: CanvasContext;
83
- displayWidth?: number;
84
- displayHeight?: number;
85
- } & canvasMutationCommand);
86
-
87
- declare type cdataNode = {
88
- type: NodeType.CDATA;
89
- textContent: '';
90
- };
91
-
92
- declare type commentNode = {
93
- type: NodeType.Comment;
94
- textContent: string;
95
- };
96
-
97
- declare type cssTextKeyAttr = {
98
- _cssText?: string;
99
- };
100
-
101
- declare type customElementCallback = (c: customElementParam) => void;
102
-
103
- declare type customElementData = {
104
- source: IncrementalSource.CustomElement;
105
- } & customElementParam;
106
-
107
- declare type customElementParam = {
108
- define?: {
109
- name: string;
110
- };
111
- };
112
-
113
- declare type customEvent<T = unknown> = {
114
- type: EventType.Custom;
115
- data: {
116
- tag: string;
117
- payload: T;
118
- };
119
- };
120
-
121
- declare type DataURLOptions = Partial<{
122
- type: string;
123
- quality: number;
124
- maxBase64ImageLength: number;
125
- }>;
126
-
127
- declare type DeprecatedMirror = {
128
- map: {
129
- [key: number]: INode;
130
- };
131
- getId: (n: Node) => number;
132
- getNode: (id: number) => INode | null;
133
- removeNodeFromMap: (n: Node) => void;
134
- has: (id: number) => boolean;
135
- reset: () => void;
136
- };
137
-
138
- declare type DocumentDimension = {
139
- x: number;
140
- y: number;
141
- relativeScale: number;
142
- absoluteScale: number;
143
- };
144
-
145
- declare type documentNode = {
146
- type: NodeType.Document;
147
- childNodes: serializedNodeWithId[];
148
- compatMode?: string;
149
- };
150
-
151
- declare type documentTypeNode = {
152
- type: NodeType.DocumentType;
153
- name: string;
154
- publicId: string;
155
- systemId: string;
156
- };
157
-
158
- declare type domContentLoadedEvent = {
159
- type: EventType.DomContentLoaded;
160
- data: unknown;
161
- };
162
-
163
- declare type elementNode = {
164
- type: NodeType.Element;
165
- tagName: string;
166
- attributes: attributes;
167
- childNodes: serializedNodeWithId[];
168
- isSVG?: true;
169
- needBlock?: boolean;
170
- isCustom?: true;
171
- };
172
-
173
- declare type Emitter = {
174
- on(type: string, handler: Handler): void;
175
- emit(type: string, event?: unknown): void;
176
- off(type: string, handler: Handler): void;
177
- };
178
-
179
- declare enum EventType {
180
- DomContentLoaded = 0,
181
- Load = 1,
182
- FullSnapshot = 2,
183
- IncrementalSnapshot = 3,
184
- Meta = 4,
185
- Custom = 5,
186
- Plugin = 6
187
- }
188
-
189
- declare type eventWithoutTime = domContentLoadedEvent | loadedEvent | fullSnapshotEvent | incrementalSnapshotEvent | metaEvent | customEvent | pluginEvent;
190
-
191
- declare type eventWithTime = eventWithoutTime & {
192
- timestamp: number;
193
- delay?: number;
194
- };
195
-
196
- declare type fontCallback = (p: fontParam) => void;
197
-
198
- declare type fontData = {
199
- source: IncrementalSource.Font;
200
- } & fontParam;
201
-
202
- declare type fontParam = {
203
- family: string;
204
- fontSource: string;
205
- buffer: boolean;
206
- descriptors?: FontFaceDescriptors;
207
- };
208
-
209
- declare type fullSnapshotEvent = {
210
- type: EventType.FullSnapshot;
211
- data: {
212
- node: serializedNodeWithId;
213
- initialOffset: {
214
- top: number;
215
- left: number;
216
- };
217
- };
218
- };
219
-
220
- declare type Handler = (event?: unknown) => void;
221
-
222
- declare type hookResetter = () => void;
223
-
224
- declare type hooksParam = {
225
- mutation?: mutationCallBack;
226
- mousemove?: mousemoveCallBack;
227
- mouseInteraction?: mouseInteractionCallBack;
228
- scroll?: scrollCallback;
229
- viewportResize?: viewportResizeCallback;
230
- input?: inputCallback;
231
- mediaInteaction?: mediaInteractionCallback;
232
- styleSheetRule?: styleSheetRuleCallback;
233
- styleDeclaration?: styleDeclarationCallback;
234
- canvasMutation?: canvasMutationCallback;
235
- font?: fontCallback;
236
- selection?: selectionCallback;
237
- customElement?: customElementCallback;
238
- };
239
-
240
- declare interface ICrossOriginIframeMirror {
241
- getId(iframe: HTMLIFrameElement, remoteId: number, parentToRemoteMap?: Map<number, number>, remoteToParentMap?: Map<number, number>): number;
242
- getIds(iframe: HTMLIFrameElement, remoteId: number[]): number[];
243
- getRemoteId(iframe: HTMLIFrameElement, parentId: number, map?: Map<number, number>): number;
244
- getRemoteIds(iframe: HTMLIFrameElement, parentId: number[]): number[];
245
- reset(iframe?: HTMLIFrameElement): void;
246
- }
247
-
248
- declare interface IMirror<TNode> {
249
- getId(n: TNode | undefined | null): number;
250
- getNode(id: number): TNode | null;
251
- getIds(): number[];
252
- getMeta(n: TNode): serializedNodeWithId | null;
253
- removeNodeFromMap(n: TNode): void;
254
- has(id: number): boolean;
255
- hasNode(node: TNode): boolean;
256
- add(n: TNode, meta: serializedNodeWithId): void;
257
- replace(id: number, n: TNode): void;
258
- reset(): void;
259
- }
260
-
261
- declare type incrementalData = mutationData | mousemoveData | mouseInteractionData | scrollData | viewportResizeData | inputData | mediaInteractionData | styleSheetRuleData | canvasMutationData | fontData | selectionData | styleDeclarationData | adoptedStyleSheetData | customElementData;
262
-
263
- declare type incrementalSnapshotEvent = {
264
- type: EventType.IncrementalSnapshot;
265
- data: incrementalData;
266
- };
267
-
268
- declare enum IncrementalSource {
269
- Mutation = 0,
270
- MouseMove = 1,
271
- MouseInteraction = 2,
272
- Scroll = 3,
273
- ViewportResize = 4,
274
- Input = 5,
275
- TouchMove = 6,
276
- MediaInteraction = 7,
277
- StyleSheetRule = 8,
278
- CanvasMutation = 9,
279
- Font = 10,
280
- Log = 11,
281
- Drag = 12,
282
- StyleDeclaration = 13,
283
- Selection = 14,
284
- AdoptedStyleSheet = 15,
285
- CustomElement = 16
286
- }
287
-
288
- declare interface INode extends Node {
289
- __sn: serializedNodeWithId;
290
- }
291
-
292
- declare type inputCallback = (v: inputValue & {
293
- id: number;
294
- }) => void;
295
-
296
- declare type inputData = {
297
- source: IncrementalSource.Input;
298
- id: number;
299
- } & inputValue;
300
-
301
- declare type inputValue = {
302
- text: string;
303
- isChecked: boolean;
304
- userTriggered?: boolean;
305
- };
306
-
307
- declare type IWindow = Window & typeof globalThis;
308
-
309
- declare type KeepIframeSrcFn = (src: string) => boolean;
310
-
311
- declare type listenerHandler = () => void;
312
-
313
- declare type loadedEvent = {
314
- type: EventType.Load;
315
- data: unknown;
316
- };
317
-
318
- declare type maskTextClass = string | RegExp;
319
-
320
- declare type mediaInteractionCallback = (p: mediaInteractionParam) => void;
321
-
322
- declare type mediaInteractionData = {
323
- source: IncrementalSource.MediaInteraction;
324
- } & mediaInteractionParam;
325
-
326
- declare type mediaInteractionParam = {
327
- type: MediaInteractions;
328
- id: number;
329
- currentTime?: number;
330
- volume?: number;
331
- muted?: boolean;
332
- loop?: boolean;
333
- playbackRate?: number;
334
- };
335
-
336
- declare enum MediaInteractions {
337
- Play = 0,
338
- Pause = 1,
339
- Seeked = 2,
340
- VolumeChange = 3,
341
- RateChange = 4
342
- }
343
-
344
- declare type metaEvent = {
345
- type: EventType.Meta;
346
- data: {
347
- href: string;
348
- width: number;
349
- height: number;
350
- };
351
- };
352
-
353
- declare type mouseInteractionCallBack = (d: mouseInteractionParam) => void;
354
-
355
- declare type mouseInteractionData = {
356
- source: IncrementalSource.MouseInteraction;
357
- } & mouseInteractionParam;
358
-
359
- declare type mouseInteractionParam = {
360
- type: MouseInteractions;
361
- id: number;
362
- x?: number;
363
- y?: number;
364
- pointerType?: PointerTypes;
365
- };
366
-
367
- declare enum MouseInteractions {
368
- MouseUp = 0,
369
- MouseDown = 1,
370
- Click = 2,
371
- ContextMenu = 3,
372
- DblClick = 4,
373
- Focus = 5,
374
- Blur = 6,
375
- TouchStart = 7,
376
- TouchMove_Departed = 8,
377
- TouchEnd = 9,
378
- TouchCancel = 10
379
- }
380
-
381
- declare type mousemoveCallBack = (p: mousePosition[], source: IncrementalSource.MouseMove | IncrementalSource.TouchMove | IncrementalSource.Drag) => void;
382
-
383
- declare type mousemoveData = {
384
- source: IncrementalSource.MouseMove | IncrementalSource.TouchMove | IncrementalSource.Drag;
385
- positions: mousePosition[];
386
- };
387
-
388
- declare type mousePosition = {
389
- x: number;
390
- y: number;
391
- id: number;
392
- timeOffset: number;
393
- };
394
-
395
- declare type mutationCallBack = (m: mutationCallbackParam) => void;
396
-
397
- declare type mutationCallbackParam = {
398
- texts: textMutation[];
399
- attributes: attributeMutation[];
400
- removes: removedNodeMutation[];
401
- adds: addedNodeMutation[];
402
- isAttachIframe?: true;
403
- };
404
-
405
- declare type mutationData = {
406
- source: IncrementalSource.Mutation;
407
- } & mutationCallbackParam;
408
-
409
- declare enum NodeType {
410
- Document = 0,
411
- DocumentType = 1,
412
- Element = 2,
413
- Text = 3,
414
- CDATA = 4,
415
- Comment = 5
416
- }
417
-
418
- declare type PackFn = (event: eventWithTime) => string;
419
-
420
- declare type playerMetaData = {
421
- startTime: number;
422
- endTime: number;
423
- totalTime: number;
424
- };
425
-
426
- declare type pluginEvent<T = unknown> = {
427
- type: EventType.Plugin;
428
- data: {
429
- plugin: string;
430
- payload: T;
431
- };
432
- };
433
-
434
- declare enum PointerTypes {
435
- Mouse = 0,
436
- Pen = 1,
437
- Touch = 2
438
- }
439
-
440
- declare type RecordPlugin<TOptions = unknown> = {
441
- name: string;
442
- observer?: (cb: (...args: Array<unknown>) => void, win: IWindow, options: TOptions) => listenerHandler;
443
- eventProcessor?: <TExtend>(event: eventWithTime) => eventWithTime & TExtend;
444
- getMirror?: (mirrors: {
445
- nodeMirror: IMirror<Node>;
446
- crossOriginIframeMirror: ICrossOriginIframeMirror;
447
- crossOriginIframeStyleMirror: ICrossOriginIframeMirror;
448
- }) => void;
449
- options: TOptions;
450
- };
451
-
452
- declare type removedNodeMutation = {
453
- parentId: number;
454
- id: number;
455
- isShadow?: boolean;
456
- };
457
-
458
- declare enum ReplayerEvents {
459
- Start = "start",
460
- Pause = "pause",
461
- Resume = "resume",
462
- Resize = "resize",
463
- Finish = "finish",
464
- FullsnapshotRebuilded = "fullsnapshot-rebuilded",
465
- LoadStylesheetStart = "load-stylesheet-start",
466
- LoadStylesheetEnd = "load-stylesheet-end",
467
- SkipStart = "skip-start",
468
- SkipEnd = "skip-end",
469
- MouseInteraction = "mouse-interaction",
470
- EventCast = "event-cast",
471
- CustomEvent = "custom-event",
472
- Flush = "flush",
473
- StateChange = "state-change",
474
- PlayBack = "play-back",
475
- Destroy = "destroy"
476
- }
477
-
478
- declare type SamplingStrategy = Partial<{
479
- mousemove: boolean | number;
480
- mousemoveCallback: number;
481
- mouseInteraction: boolean | Record<string, boolean | undefined>;
482
- scroll: number;
483
- media: number;
484
- input: 'all' | 'last';
485
- canvas: 'all' | number;
486
- }>;
487
-
488
- declare type scrollCallback = (p: scrollPosition) => void;
489
-
490
- declare type scrollData = {
491
- source: IncrementalSource.Scroll;
492
- } & scrollPosition;
493
-
494
- declare type scrollPosition = {
495
- id: number;
496
- x: number;
497
- y: number;
498
- };
499
-
500
- declare type selectionCallback = (p: selectionParam) => void;
501
-
502
- declare type selectionData = {
503
- source: IncrementalSource.Selection;
504
- } & selectionParam;
505
-
506
- declare type selectionParam = {
507
- ranges: Array<SelectionRange>;
508
- };
509
-
510
- declare type SelectionRange = {
511
- start: number;
512
- startOffset: number;
513
- end: number;
514
- endOffset: number;
515
- };
516
-
517
- declare type serializedNode = (documentNode | documentTypeNode | elementNode | textNode | cdataNode | commentNode) & {
518
- rootId?: number;
519
- isShadowHost?: boolean;
520
- isShadow?: boolean;
521
- };
522
-
523
- declare type serializedNodeWithId = serializedNode & {
524
- id: number;
525
- };
526
-
527
- declare type styleDeclarationCallback = (s: styleDeclarationParam) => void;
528
-
529
- declare type styleDeclarationData = {
530
- source: IncrementalSource.StyleDeclaration;
531
- } & styleDeclarationParam;
532
-
533
- declare type styleDeclarationParam = {
534
- id?: number;
535
- styleId?: number;
536
- index: number[];
537
- set?: {
538
- property: string;
539
- value: string | null;
540
- priority: string | undefined;
541
- };
542
- remove?: {
543
- property: string;
544
- };
545
- };
546
-
547
- declare type styleOMValue = {
548
- [key: string]: styleValueWithPriority | string | false;
549
- };
550
-
551
- declare type styleSheetAddRule = {
552
- rule: string;
553
- index?: number | number[];
554
- };
555
-
556
- declare type styleSheetDeleteRule = {
557
- index: number | number[];
558
- };
559
-
560
- declare type styleSheetRuleCallback = (s: styleSheetRuleParam) => void;
561
-
562
- declare type styleSheetRuleData = {
563
- source: IncrementalSource.StyleSheetRule;
564
- } & styleSheetRuleParam;
565
-
566
- declare type styleSheetRuleParam = {
567
- id?: number;
568
- styleId?: number;
569
- removes?: styleSheetDeleteRule[];
570
- adds?: styleSheetAddRule[];
571
- replace?: string;
572
- replaceSync?: string;
573
- };
574
-
575
- declare type styleValueWithPriority = [string, string];
576
-
577
- declare type textMutation = {
578
- id: number;
579
- value: string | null;
580
- };
581
-
582
- declare type textNode = {
583
- type: NodeType.Text;
584
- textContent: string;
585
- isStyle?: true;
586
- };
587
-
588
- declare type throttleOptions = {
589
- leading?: boolean;
590
- trailing?: boolean;
591
- };
592
-
593
- declare type UnpackFn = (raw: string) => eventWithTime;
594
-
595
- declare type viewportResizeCallback = (d: viewportResizeDimension) => void;
596
-
597
- declare type viewportResizeData = {
598
- source: IncrementalSource.ViewportResize;
599
- } & viewportResizeDimension;
600
-
601
- declare type viewportResizeDimension = {
602
- width: number;
603
- height: number;
604
- };
605
-
606
-
607
-
1
+ //#region src/index.d.ts
2
+ declare enum EventType {
3
+ DomContentLoaded = 0,
4
+ Load = 1,
5
+ FullSnapshot = 2,
6
+ IncrementalSnapshot = 3,
7
+ Meta = 4,
8
+ Custom = 5,
9
+ Plugin = 6
10
+ }
11
+ type domContentLoadedEvent = {
12
+ type: EventType.DomContentLoaded;
13
+ data: unknown;
14
+ };
15
+ type loadedEvent = {
16
+ type: EventType.Load;
17
+ data: unknown;
18
+ };
19
+ type fullSnapshotEvent = {
20
+ type: EventType.FullSnapshot;
21
+ data: {
22
+ node: serializedNodeWithId;
23
+ initialOffset: {
24
+ top: number;
25
+ left: number;
26
+ };
27
+ };
28
+ };
29
+ type incrementalSnapshotEvent = {
30
+ type: EventType.IncrementalSnapshot;
31
+ data: incrementalData;
32
+ };
33
+ type metaEvent = {
34
+ type: EventType.Meta;
35
+ data: {
36
+ href: string;
37
+ width: number;
38
+ height: number;
39
+ };
40
+ };
41
+ type customEvent<T = unknown> = {
42
+ type: EventType.Custom;
43
+ data: {
44
+ tag: string;
45
+ payload: T;
46
+ };
47
+ };
48
+ type pluginEvent<T = unknown> = {
49
+ type: EventType.Plugin;
50
+ data: {
51
+ plugin: string;
52
+ payload: T;
53
+ };
54
+ };
55
+ declare enum IncrementalSource {
56
+ Mutation = 0,
57
+ MouseMove = 1,
58
+ MouseInteraction = 2,
59
+ Scroll = 3,
60
+ ViewportResize = 4,
61
+ Input = 5,
62
+ TouchMove = 6,
63
+ MediaInteraction = 7,
64
+ StyleSheetRule = 8,
65
+ CanvasMutation = 9,
66
+ Font = 10,
67
+ Log = 11,
68
+ Drag = 12,
69
+ StyleDeclaration = 13,
70
+ Selection = 14,
71
+ AdoptedStyleSheet = 15,
72
+ CustomElement = 16
73
+ }
74
+ type mutationData = {
75
+ source: IncrementalSource.Mutation;
76
+ } & mutationCallbackParam;
77
+ type mousemoveData = {
78
+ source: IncrementalSource.MouseMove | IncrementalSource.TouchMove | IncrementalSource.Drag;
79
+ positions: mousePosition[];
80
+ };
81
+ type mouseInteractionData = {
82
+ source: IncrementalSource.MouseInteraction;
83
+ } & mouseInteractionParam;
84
+ type scrollData = {
85
+ source: IncrementalSource.Scroll;
86
+ } & scrollPosition;
87
+ type viewportResizeData = {
88
+ source: IncrementalSource.ViewportResize;
89
+ } & viewportResizeDimension;
90
+ type inputData = {
91
+ source: IncrementalSource.Input;
92
+ id: number;
93
+ } & inputValue;
94
+ type mediaInteractionData = {
95
+ source: IncrementalSource.MediaInteraction;
96
+ } & mediaInteractionParam;
97
+ type styleSheetRuleData = {
98
+ source: IncrementalSource.StyleSheetRule;
99
+ } & styleSheetRuleParam;
100
+ type styleDeclarationData = {
101
+ source: IncrementalSource.StyleDeclaration;
102
+ } & styleDeclarationParam;
103
+ type canvasMutationData = {
104
+ source: IncrementalSource.CanvasMutation;
105
+ } & canvasMutationParam;
106
+ type fontData = {
107
+ source: IncrementalSource.Font;
108
+ } & fontParam;
109
+ type selectionData = {
110
+ source: IncrementalSource.Selection;
111
+ } & selectionParam;
112
+ type adoptedStyleSheetData = {
113
+ source: IncrementalSource.AdoptedStyleSheet;
114
+ } & adoptedStyleSheetParam;
115
+ type customElementData = {
116
+ source: IncrementalSource.CustomElement;
117
+ } & customElementParam;
118
+ type incrementalData = mutationData | mousemoveData | mouseInteractionData | scrollData | viewportResizeData | inputData | mediaInteractionData | styleSheetRuleData | canvasMutationData | fontData | selectionData | styleDeclarationData | adoptedStyleSheetData | customElementData;
119
+ type eventWithoutTime = domContentLoadedEvent | loadedEvent | fullSnapshotEvent | incrementalSnapshotEvent | metaEvent | customEvent | pluginEvent;
120
+ type eventWithTime = eventWithoutTime & {
121
+ timestamp: number;
122
+ delay?: number;
123
+ };
124
+ type canvasEventWithTime = eventWithTime & {
125
+ type: EventType.IncrementalSnapshot;
126
+ data: canvasMutationData;
127
+ };
128
+ type blockClass = string | RegExp;
129
+ type maskTextClass = string | RegExp;
130
+ type SamplingStrategy = Partial<{
131
+ /**
132
+ * false means not to record mouse/touch move events
133
+ * number is the throttle threshold of recording mouse/touch move
134
+ */
135
+ mousemove: boolean | number;
136
+ /**
137
+ * number is the throttle threshold of mouse/touch move callback
138
+ */
139
+ mousemoveCallback: number;
140
+ /**
141
+ * false means not to record mouse interaction events
142
+ * can also specify record some kinds of mouse interactions
143
+ */
144
+ mouseInteraction: boolean | Record<string, boolean | undefined>;
145
+ /**
146
+ * number is the throttle threshold of recording scroll
147
+ */
148
+ scroll: number;
149
+ /**
150
+ * number is the throttle threshold of recording media interactions
151
+ */
152
+ media: number;
153
+ /**
154
+ * 'all' will record all the input events
155
+ * 'last' will only record the last input value while input a sequence of chars
156
+ */
157
+ input: "all" | "last";
158
+ /**
159
+ * 'all' will record every single canvas call
160
+ * number between 1 and 60, will record an image snapshots in a web-worker a (maximum) number of times per second.
161
+ * Number only supported where [`OffscreenCanvas`](http://mdn.io/offscreencanvas) is supported.
162
+ */
163
+ canvas: "all" | number;
164
+ }>;
165
+ interface ICrossOriginIframeMirror {
166
+ getId(iframe: HTMLIFrameElement, remoteId: number, parentToRemoteMap?: Map<number, number>, remoteToParentMap?: Map<number, number>): number;
167
+ getIds(iframe: HTMLIFrameElement, remoteId: number[]): number[];
168
+ getRemoteId(iframe: HTMLIFrameElement, parentId: number, map?: Map<number, number>): number;
169
+ getRemoteIds(iframe: HTMLIFrameElement, parentId: number[]): number[];
170
+ reset(iframe?: HTMLIFrameElement): void;
171
+ }
172
+ type RecordPlugin<TOptions = unknown> = {
173
+ name: string;
174
+ observer?: (cb: (...args: Array<unknown>) => void, win: IWindow, options: TOptions) => listenerHandler;
175
+ eventProcessor?: <TExtend>(event: eventWithTime) => eventWithTime & TExtend;
176
+ getMirror?: (mirrors: {
177
+ nodeMirror: IMirror<Node>;
178
+ crossOriginIframeMirror: ICrossOriginIframeMirror;
179
+ crossOriginIframeStyleMirror: ICrossOriginIframeMirror;
180
+ }) => void;
181
+ options: TOptions;
182
+ };
183
+ type hooksParam = {
184
+ mutation?: mutationCallBack;
185
+ mousemove?: mousemoveCallBack;
186
+ mouseInteraction?: mouseInteractionCallBack;
187
+ scroll?: scrollCallback;
188
+ viewportResize?: viewportResizeCallback;
189
+ input?: inputCallback;
190
+ mediaInteaction?: mediaInteractionCallback;
191
+ styleSheetRule?: styleSheetRuleCallback;
192
+ styleDeclaration?: styleDeclarationCallback;
193
+ canvasMutation?: canvasMutationCallback;
194
+ font?: fontCallback;
195
+ selection?: selectionCallback;
196
+ customElement?: customElementCallback;
197
+ };
198
+ type textMutation = {
199
+ id: number;
200
+ value: string | null;
201
+ };
202
+ type styleOMValue = {
203
+ [key: string]: styleValueWithPriority | string | false;
204
+ };
205
+ type styleValueWithPriority = [string, string];
206
+ type attributeMutation = {
207
+ id: number;
208
+ attributes: {
209
+ [key: string]: string | styleOMValue | null;
210
+ };
211
+ };
212
+ type removedNodeMutation = {
213
+ parentId: number;
214
+ id: number;
215
+ isShadow?: boolean;
216
+ };
217
+ type addedNodeMutation = {
218
+ parentId: number;
219
+ previousId?: number | null;
220
+ nextId: number | null;
221
+ node: serializedNodeWithId;
222
+ };
223
+ type mutationCallbackParam = {
224
+ texts: textMutation[];
225
+ attributes: attributeMutation[];
226
+ removes: removedNodeMutation[];
227
+ adds: addedNodeMutation[];
228
+ isAttachIframe?: true;
229
+ };
230
+ type mutationCallBack = (m: mutationCallbackParam) => void;
231
+ type mousemoveCallBack = (p: mousePosition[], source: IncrementalSource.MouseMove | IncrementalSource.TouchMove | IncrementalSource.Drag) => void;
232
+ type mousePosition = {
233
+ x: number;
234
+ y: number;
235
+ id: number;
236
+ timeOffset: number;
237
+ };
238
+ declare enum MouseInteractions {
239
+ MouseUp = 0,
240
+ MouseDown = 1,
241
+ Click = 2,
242
+ ContextMenu = 3,
243
+ DblClick = 4,
244
+ Focus = 5,
245
+ Blur = 6,
246
+ TouchStart = 7,
247
+ TouchMove_Departed = 8,
248
+ TouchEnd = 9,
249
+ TouchCancel = 10
250
+ }
251
+ declare enum PointerTypes {
252
+ Mouse = 0,
253
+ Pen = 1,
254
+ Touch = 2
255
+ }
256
+ declare enum CanvasContext {
257
+ "2D" = 0,
258
+ WebGL = 1,
259
+ WebGL2 = 2
260
+ }
261
+ type mouseInteractionParam = {
262
+ type: MouseInteractions;
263
+ id: number;
264
+ x?: number;
265
+ y?: number;
266
+ pointerType?: PointerTypes;
267
+ };
268
+ type mouseInteractionCallBack = (d: mouseInteractionParam) => void;
269
+ type scrollPosition = {
270
+ id: number;
271
+ x: number;
272
+ y: number;
273
+ };
274
+ type scrollCallback = (p: scrollPosition) => void;
275
+ type styleSheetAddRule = {
276
+ rule: string;
277
+ index?: number | number[];
278
+ };
279
+ type styleSheetDeleteRule = {
280
+ index: number | number[];
281
+ };
282
+ type styleSheetRuleParam = {
283
+ id?: number;
284
+ styleId?: number;
285
+ removes?: styleSheetDeleteRule[];
286
+ adds?: styleSheetAddRule[];
287
+ replace?: string;
288
+ replaceSync?: string;
289
+ };
290
+ type styleSheetRuleCallback = (s: styleSheetRuleParam) => void;
291
+ type adoptedStyleSheetParam = {
292
+ id: number;
293
+ styles?: {
294
+ styleId: number;
295
+ rules: styleSheetAddRule[];
296
+ }[];
297
+ styleIds: number[];
298
+ };
299
+ type styleDeclarationParam = {
300
+ id?: number;
301
+ styleId?: number;
302
+ index: number[];
303
+ set?: {
304
+ property: string;
305
+ value: string | null;
306
+ priority: string | undefined;
307
+ };
308
+ remove?: {
309
+ property: string;
310
+ };
311
+ };
312
+ type styleDeclarationCallback = (s: styleDeclarationParam) => void;
313
+ type canvasMutationCommand = {
314
+ property: string;
315
+ args: Array<unknown>;
316
+ setter?: true;
317
+ };
318
+ type canvasMutationParam = {
319
+ id: number;
320
+ type: CanvasContext;
321
+ commands: canvasMutationCommand[];
322
+ displayWidth?: number;
323
+ displayHeight?: number;
324
+ } | ({
325
+ id: number;
326
+ type: CanvasContext;
327
+ displayWidth?: number;
328
+ displayHeight?: number;
329
+ } & canvasMutationCommand);
330
+ type canvasMutationCallback = (p: canvasMutationParam) => void;
331
+ type CanvasMaskRegion = {
332
+ x: number;
333
+ y: number;
334
+ width: number;
335
+ height: number;
336
+ };
337
+ type CanvasMasking = {
338
+ regionsFn?: (canvas: HTMLCanvasElement) => CanvasMaskRegion[] | null | undefined;
339
+ configured?: () => boolean;
340
+ };
341
+ type fontParam = {
342
+ family: string;
343
+ fontSource: string;
344
+ buffer: boolean;
345
+ descriptors?: FontFaceDescriptors;
346
+ };
347
+ type fontCallback = (p: fontParam) => void;
348
+ type viewportResizeDimension = {
349
+ width: number;
350
+ height: number;
351
+ };
352
+ type viewportResizeCallback = (d: viewportResizeDimension) => void;
353
+ type inputValue = {
354
+ text: string;
355
+ isChecked: boolean;
356
+ userTriggered?: boolean;
357
+ };
358
+ type inputCallback = (v: inputValue & {
359
+ id: number;
360
+ }) => void;
361
+ declare enum MediaInteractions {
362
+ Play = 0,
363
+ Pause = 1,
364
+ Seeked = 2,
365
+ VolumeChange = 3,
366
+ RateChange = 4
367
+ }
368
+ type mediaInteractionParam = {
369
+ type: MediaInteractions;
370
+ id: number;
371
+ currentTime?: number;
372
+ volume?: number;
373
+ muted?: boolean;
374
+ loop?: boolean;
375
+ playbackRate?: number;
376
+ };
377
+ type mediaInteractionCallback = (p: mediaInteractionParam) => void;
378
+ type DocumentDimension = {
379
+ x: number;
380
+ y: number;
381
+ relativeScale: number;
382
+ absoluteScale: number;
383
+ };
384
+ type SelectionRange = {
385
+ start: number;
386
+ startOffset: number;
387
+ end: number;
388
+ endOffset: number;
389
+ };
390
+ type selectionParam = {
391
+ ranges: Array<SelectionRange>;
392
+ };
393
+ type selectionCallback = (p: selectionParam) => void;
394
+ type customElementParam = {
395
+ define?: {
396
+ name: string;
397
+ };
398
+ };
399
+ type customElementCallback = (c: customElementParam) => void;
400
+ /**
401
+ * @deprecated
402
+ */
403
+ interface INode extends Node {
404
+ __sn: serializedNodeWithId;
405
+ }
406
+ type DeprecatedMirror = {
407
+ map: {
408
+ [key: number]: INode;
409
+ };
410
+ getId: (n: Node) => number;
411
+ getNode: (id: number) => INode | null;
412
+ removeNodeFromMap: (n: Node) => void;
413
+ has: (id: number) => boolean;
414
+ reset: () => void;
415
+ };
416
+ type throttleOptions = {
417
+ leading?: boolean;
418
+ trailing?: boolean;
419
+ };
420
+ type listenerHandler = () => void;
421
+ type hookResetter = () => void;
422
+ type playerMetaData = {
423
+ startTime: number;
424
+ endTime: number;
425
+ totalTime: number;
426
+ };
427
+ type actionWithDelay = {
428
+ doAction: () => void;
429
+ delay: number;
430
+ };
431
+ type Handler = (event?: unknown) => void;
432
+ type Emitter = {
433
+ on(type: string, handler: Handler): void;
434
+ emit(type: string, event?: unknown): void;
435
+ off(type: string, handler: Handler): void;
436
+ };
437
+ declare enum ReplayerEvents {
438
+ Start = "start",
439
+ Pause = "pause",
440
+ /**
441
+ * @deprecated use Play instead
442
+ */
443
+ Resume = "resume",
444
+ Resize = "resize",
445
+ Finish = "finish",
446
+ FullsnapshotRebuilded = "fullsnapshot-rebuilded",
447
+ LoadStylesheetStart = "load-stylesheet-start",
448
+ LoadStylesheetEnd = "load-stylesheet-end",
449
+ SkipStart = "skip-start",
450
+ SkipEnd = "skip-end",
451
+ MouseInteraction = "mouse-interaction",
452
+ EventCast = "event-cast",
453
+ CustomEvent = "custom-event",
454
+ Flush = "flush",
455
+ StateChange = "state-change",
456
+ PlayBack = "play-back",
457
+ Destroy = "destroy"
458
+ }
459
+ type KeepIframeSrcFn = (src: string) => boolean;
608
460
  declare global {
609
- interface Window {
610
- FontFace: typeof FontFace;
611
- }
461
+ interface Window {
462
+ FontFace: typeof FontFace;
463
+ }
464
+ }
465
+ type IWindow = Window & typeof globalThis;
466
+ declare enum NodeType {
467
+ Document = 0,
468
+ DocumentType = 1,
469
+ Element = 2,
470
+ Text = 3,
471
+ CDATA = 4,
472
+ Comment = 5
473
+ }
474
+ type documentNode = {
475
+ type: NodeType.Document;
476
+ childNodes: serializedNodeWithId[];
477
+ compatMode?: string;
478
+ };
479
+ type documentTypeNode = {
480
+ type: NodeType.DocumentType;
481
+ name: string;
482
+ publicId: string;
483
+ systemId: string;
484
+ };
485
+ type cssTextKeyAttr = {
486
+ _cssText?: string;
487
+ };
488
+ type attributes = cssTextKeyAttr & {
489
+ [key: string]: string | number | true | null;
490
+ };
491
+ type elementNode = {
492
+ type: NodeType.Element;
493
+ tagName: string;
494
+ attributes: attributes;
495
+ childNodes: serializedNodeWithId[];
496
+ isSVG?: true;
497
+ needBlock?: boolean;
498
+ isCustom?: true;
499
+ };
500
+ type textNode = {
501
+ type: NodeType.Text;
502
+ textContent: string;
503
+ /**
504
+ * @deprecated styles are now always snapshotted against parent <style> element
505
+ * style mutations can still happen via an added textNode, but they don't need this attribute for correct replay
506
+ */
507
+ isStyle?: true;
508
+ };
509
+ type cdataNode = {
510
+ type: NodeType.CDATA;
511
+ textContent: "";
512
+ };
513
+ type commentNode = {
514
+ type: NodeType.Comment;
515
+ textContent: string;
516
+ };
517
+ type serializedNode = (documentNode | documentTypeNode | elementNode | textNode | cdataNode | commentNode) & {
518
+ rootId?: number;
519
+ isShadowHost?: boolean;
520
+ isShadow?: boolean;
521
+ };
522
+ type serializedNodeWithId = serializedNode & {
523
+ id: number;
524
+ };
525
+ interface IMirror<TNode> {
526
+ getId(n: TNode | undefined | null): number;
527
+ getNode(id: number): TNode | null;
528
+ getIds(): number[];
529
+ getMeta(n: TNode): serializedNodeWithId | null;
530
+ removeNodeFromMap(n: TNode): void;
531
+ has(id: number): boolean;
532
+ hasNode(node: TNode): boolean;
533
+ add(n: TNode, meta: serializedNodeWithId): void;
534
+ replace(id: number, n: TNode): void;
535
+ reset(): void;
612
536
  }
537
+ type DataURLOptions = Partial<{
538
+ type: string;
539
+ quality: number;
540
+ maxBase64ImageLength: number;
541
+ }>;
542
+ type PackFn = (event: eventWithTime) => string;
543
+ type UnpackFn = (raw: string) => eventWithTime;
613
544
 
614
- declare type DeferredStylesheetStats = {
615
- deferredCount: number;
616
- failedCount: number;
617
- abandonedCount: number;
618
- totalMs: number;
619
- slowestSliceMs: number;
620
- };
621
-
622
- declare function getDeferredStylesheetStats(): DeferredStylesheetStats;
623
-
624
- declare function getDiscardedDurationSamples(): number;
625
-
626
- declare function getLastSnapshotCost(): SnapshotCost | null;
627
-
628
- declare function getMutationCost(): MutationCost;
629
-
630
- declare type MaskAttributeFn = (name: string, value: string, element: Element) => string;
631
-
632
- declare type MaskInputFn = (text: string, element: HTMLElement) => string;
633
-
634
- declare type MaskInputOptions = Partial<{
635
- color: boolean;
636
- date: boolean;
637
- 'datetime-local': boolean;
638
- email: boolean;
639
- month: boolean;
640
- number: boolean;
641
- range: boolean;
642
- search: boolean;
643
- tel: boolean;
644
- text: boolean;
645
- time: boolean;
646
- url: boolean;
647
- week: boolean;
648
- textarea: boolean;
649
- select: boolean;
650
- password: boolean;
651
- }>;
652
-
653
- declare type MaskTextFn = (text: string, element: HTMLElement | null) => string;
654
-
655
- declare class Mirror$1 implements IMirror<Node> {
656
- private idNodeMap;
657
- private nodeMetaMap;
658
- getId(n: Node | undefined | null): number;
659
- getNode(id: number): Node | null;
660
- getIds(): number[];
661
- getMeta(n: Node): serializedNodeWithId | null;
662
- removeNodeFromMap(n: Node): void;
663
- has(id: number): boolean;
664
- hasNode(node: Node): boolean;
665
- add(n: Node, meta: serializedNodeWithId): void;
666
- replace(id: number, n: Node): void;
667
- reset(): void;
668
- }
669
-
670
- declare type MutationCost = {
671
- slowestBatchMs: number;
672
- };
673
-
674
- declare function resetMaxDepthState(): void;
675
-
676
- declare function resetSnapshotCostState(): void;
677
-
678
- declare type SlimDOMOptions = Partial<{
679
- script: boolean;
680
- comment: boolean;
681
- headFavicon: boolean;
682
- headWhitespace: boolean;
683
- headMetaDescKeywords: boolean;
684
- headMetaSocial: boolean;
685
- headMetaRobots: boolean;
686
- headMetaHttpEquiv: boolean;
687
- headMetaAuthorship: boolean;
688
- headMetaVerification: boolean;
689
- headTitleMutations: boolean;
690
- }>;
691
-
692
- declare type SnapshotCost = {
693
- durationMs: number;
694
- stylesheetMs: number;
695
- nodeCount: number;
696
- cssRuleCount: number;
697
- nonDeferrableCssRuleCount: number;
698
- deferredStylesheetCount: number;
699
- };
700
-
545
+ type MaskInputOptions = Partial<{
546
+ color: boolean;
547
+ date: boolean;
548
+ "datetime-local": boolean;
549
+ email: boolean;
550
+ month: boolean;
551
+ number: boolean;
552
+ range: boolean;
553
+ search: boolean;
554
+ tel: boolean;
555
+ text: boolean;
556
+ time: boolean;
557
+ url: boolean;
558
+ week: boolean;
559
+ textarea: boolean;
560
+ select: boolean;
561
+ password: boolean;
562
+ }>;
563
+ type SlimDOMOptions = Partial<{
564
+ script: boolean;
565
+ comment: boolean;
566
+ headFavicon: boolean;
567
+ headWhitespace: boolean;
568
+ headMetaDescKeywords: boolean;
569
+ headMetaSocial: boolean;
570
+ headMetaRobots: boolean;
571
+ headMetaHttpEquiv: boolean;
572
+ headMetaAuthorship: boolean;
573
+ headMetaVerification: boolean;
574
+ /**
575
+ * blocks title tag 'animations' which can generate a lot of mutations that aren't usually displayed in replayers
576
+ **/
577
+ headTitleMutations: boolean;
578
+ }>;
579
+ type MaskTextFn = (text: string, element: HTMLElement | null) => string;
580
+ type MaskInputFn = (text: string, element: HTMLElement) => string;
581
+ type MaskAttributeFn = (name: string, value: string, element: Element) => string;
582
+ declare class Mirror$1 implements IMirror<Node> {
583
+ private idNodeMap;
584
+ private nodeMetaMap;
585
+ getId(n: Node | undefined | null): number;
586
+ getNode(id: number): Node | null;
587
+ getIds(): number[];
588
+ getMeta(n: Node): serializedNodeWithId | null;
589
+ removeNodeFromMap(n: Node): void;
590
+ has(id: number): boolean;
591
+ hasNode(node: Node): boolean;
592
+ add(n: Node, meta: serializedNodeWithId): void;
593
+ replace(id: number, n: Node): void;
594
+ reset(): void;
595
+ }
701
596
  declare function wasMaxDepthReached(): boolean;
597
+ declare function resetMaxDepthState(): void;
598
+ //#endregion
599
+ //#region src/snapshot-cost.d.ts
600
+ /**
601
+ * Snapshot cost accounting.
602
+ *
603
+ * Serializing the DOM is unbounded synchronous work on the main thread: a wide,
604
+ * shallow, stylesheet-heavy document can hold the thread for seconds, which the
605
+ * page sees as a total UI freeze. The existing `maxDepth` guard only bounds
606
+ * *deep* documents, so that whole class of cost was previously unmeasured.
607
+ *
608
+ * This module keeps the measurement in one place so both `snapshot()` and the
609
+ * incremental mutation path can report how much time they spent, and so the
610
+ * expensive-by-far part - `stringifyStylesheet` over every CSSRule of every
611
+ * sheet - can be capped and deferred instead of blocking first paint.
612
+ */
613
+ type SnapshotCost = {
614
+ /** wall-clock ms of the whole tracked window (the full snapshot task) */
615
+ durationMs: number;
616
+ /** of `durationMs`, ms spent stringifying stylesheets */
617
+ stylesheetMs: number;
618
+ /** DOM nodes visited by the serializer */
619
+ nodeCount: number;
620
+ /** CSSRules read while stringifying stylesheets, all sources */
621
+ cssRuleCount: number;
622
+ /**
623
+ * of `cssRuleCount`, rules from sources that can never be deferred
624
+ * (CSSOM-only `<style>` elements, adoptedStyleSheets). These do not charge
625
+ * the inlining budget: deferring other sheets buys them no freeze reduction.
626
+ */
627
+ nonDeferrableCssRuleCount: number;
628
+ /** `<link rel=stylesheet>` elements whose inlining was deferred past the budget */
629
+ deferredStylesheetCount: number;
630
+ };
631
+ type MutationCost = {
632
+ /** slowest single mutation batch, in ms, since the last reset */
633
+ slowestBatchMs: number;
634
+ };
635
+ /**
636
+ * Session-cumulative accounting of budget-deferred stylesheets. `failedCount`
637
+ * and `abandonedCount` are sheets that never made it back into the recording:
638
+ * both leave the `<link>` serialized with only `rel`/`href`, so replay falls
639
+ * back to loading the CSS from its original URL - which may 404 or have
640
+ * changed by then.
641
+ */
642
+ type DeferredStylesheetStats = {
643
+ /** deferral events across every snapshot (a re-deferred sheet counts again) */
644
+ deferredCount: number;
645
+ /** deferred sheets whose idle-time stringification produced nothing */
646
+ failedCount: number;
647
+ /** deferred sheets dropped when a teardown flush hit its safety cap */
648
+ abandonedCount: number;
649
+ /** ms spent stringifying deferred sheets, across every slice */
650
+ totalMs: number;
651
+ /** slowest single slice of deferred stringification, in ms */
652
+ slowestSliceMs: number;
653
+ };
654
+ declare function getDiscardedDurationSamples(): number;
655
+ /** Cost of the most recent completed `snapshot()`, or null if none has run. */
656
+ declare function getLastSnapshotCost(): SnapshotCost | null;
657
+ declare function getDeferredStylesheetStats(): DeferredStylesheetStats;
658
+ declare function getMutationCost(): MutationCost;
659
+ declare function resetSnapshotCostState(): void;
702
660
 
703
- declare class BaseRRCDATASection extends BaseRRNode implements IRRCDATASection {
704
- readonly nodeName: "#cdata-section";
705
- readonly nodeType: number;
706
- readonly RRNodeType = NodeType.CDATA;
707
- data: string;
708
- constructor(data: string);
709
- get textContent(): string;
710
- set textContent(textContent: string);
711
- toString(): string;
712
- }
713
-
714
- declare class BaseRRComment extends BaseRRNode implements IRRComment {
715
- readonly nodeType: number;
716
- readonly nodeName: "#comment";
717
- readonly RRNodeType = NodeType.Comment;
718
- data: string;
719
- constructor(data: string);
720
- get textContent(): string;
721
- set textContent(textContent: string);
722
- toString(): string;
723
- }
724
-
725
- declare class BaseRRDocument extends BaseRRNode implements IRRDocument {
726
- readonly nodeType: number;
727
- readonly nodeName: "#document";
728
- readonly compatMode: 'BackCompat' | 'CSS1Compat';
729
- readonly RRNodeType = NodeType.Document;
730
- textContent: string | null;
731
- constructor(...args: any[]);
732
- get documentElement(): IRRElement | null;
733
- get body(): IRRElement | null;
734
- get head(): IRRElement | null;
735
- get implementation(): IRRDocument;
736
- get firstElementChild(): IRRElement | null;
737
- appendChild(newChild: IRRNode): IRRNode;
738
- insertBefore(newChild: IRRNode, refChild: IRRNode | null): IRRNode;
739
- removeChild(node: IRRNode): IRRNode;
740
- open(): void;
741
- close(): void;
742
- write(content: string): void;
743
- createDocument(_namespace: string | null, _qualifiedName: string | null, _doctype?: DocumentType | null): IRRDocument;
744
- createDocumentType(qualifiedName: string, publicId: string, systemId: string): IRRDocumentType;
745
- createElement(tagName: string): IRRElement;
746
- createElementNS(_namespaceURI: string, qualifiedName: string): IRRElement;
747
- createTextNode(data: string): IRRText;
748
- createComment(data: string): IRRComment;
749
- createCDATASection(data: string): IRRCDATASection;
750
- toString(): string;
751
- }
752
-
753
- declare class BaseRRDocumentType extends BaseRRNode implements IRRDocumentType {
754
- readonly nodeType: number;
755
- readonly RRNodeType = NodeType.DocumentType;
756
- readonly nodeName: string;
757
- readonly name: string;
758
- readonly publicId: string;
759
- readonly systemId: string;
760
- textContent: string | null;
761
- constructor(qualifiedName: string, publicId: string, systemId: string);
762
- toString(): string;
763
- }
764
-
765
- declare class BaseRRElement extends BaseRRNode implements IRRElement {
766
- readonly nodeType: number;
767
- readonly RRNodeType = NodeType.Element;
768
- readonly nodeName: string;
769
- tagName: string;
770
- attributes: Record<string, string>;
771
- shadowRoot: IRRElement | null;
772
- scrollLeft?: number;
773
- scrollTop?: number;
774
- constructor(tagName: string);
775
- get textContent(): string;
776
- set textContent(textContent: string);
777
- get classList(): ClassList;
778
- get id(): string;
779
- get className(): string;
780
- get style(): CSSStyleDeclaration_2;
781
- getAttribute(name: string): string | null;
782
- setAttribute(name: string, attribute: string): void;
783
- setAttributeNS(_namespace: string | null, qualifiedName: string, value: string): void;
784
- removeAttribute(name: string): void;
785
- appendChild(newChild: IRRNode): IRRNode;
786
- insertBefore(newChild: IRRNode, refChild: IRRNode | null): IRRNode;
787
- removeChild(node: IRRNode): IRRNode;
788
- attachShadow(_init: ShadowRootInit): IRRElement;
789
- dispatchEvent(_event: Event): boolean;
790
- toString(): string;
791
- }
792
-
793
- declare class BaseRRMediaElement extends BaseRRElement {
794
- currentTime?: number;
795
- volume?: number;
796
- paused?: boolean;
797
- muted?: boolean;
798
- playbackRate?: number;
799
- loop?: boolean;
800
- attachShadow(_init: ShadowRootInit): IRRElement;
801
- play(): void;
802
- pause(): void;
803
- }
804
-
805
- declare abstract class BaseRRNode implements IRRNode {
806
- parentElement: IRRNode | null;
807
- parentNode: IRRNode | null;
808
- ownerDocument: IRRDocument;
809
- firstChild: IRRNode | null;
810
- lastChild: IRRNode | null;
811
- previousSibling: IRRNode | null;
812
- nextSibling: IRRNode | null;
813
- abstract textContent: string | null;
814
- readonly ELEMENT_NODE: number;
815
- readonly TEXT_NODE: number;
816
- readonly nodeType: number;
817
- readonly nodeName: string;
818
- readonly RRNodeType: NodeType;
819
- constructor(..._args: any[]);
820
- get childNodes(): IRRNode[];
821
- contains(node: IRRNode): boolean;
822
- appendChild(_newChild: IRRNode): IRRNode;
823
- insertBefore(_newChild: IRRNode, _refChild: IRRNode | null): IRRNode;
824
- removeChild(_node: IRRNode): IRRNode;
825
- toString(): string;
826
- }
827
-
828
-
829
- declare class BaseRRText extends BaseRRNode implements IRRText {
830
- readonly nodeType: number;
831
- readonly nodeName: "#text";
832
- readonly RRNodeType = NodeType.Text;
833
- data: string;
834
- constructor(data: string);
835
- get textContent(): string;
836
- set textContent(textContent: string);
837
- toString(): string;
838
- }
839
-
840
- declare class ClassList {
841
- private onChange;
842
- classes: string[];
843
- constructor(classText?: string, onChange?: ((newClassText: string) => void) | undefined);
844
- add: (...classNames: string[]) => void;
845
- remove: (...classNames: string[]) => void;
846
- }
847
-
848
- declare type CSSStyleDeclaration_2 = Record<string, string> & {
849
- setProperty: (name: string, value: string | null, priority?: string | null) => void;
850
- removeProperty: (name: string) => string;
851
- };
852
-
853
-
854
- declare interface IRRCDATASection extends IRRNode {
855
- readonly nodeName: '#cdata-section';
856
- data: string;
857
- }
858
-
859
- declare interface IRRComment extends IRRNode {
860
- readonly nodeName: '#comment';
861
- data: string;
862
- }
863
-
864
- declare interface IRRDocument extends IRRNode {
865
- documentElement: IRRElement | null;
866
- body: IRRElement | null;
867
- head: IRRElement | null;
868
- implementation: IRRDocument;
869
- firstElementChild: IRRElement | null;
870
- readonly nodeName: '#document';
871
- compatMode: 'BackCompat' | 'CSS1Compat';
872
- createDocument(_namespace: string | null, _qualifiedName: string | null, _doctype?: DocumentType | null): IRRDocument;
873
- createDocumentType(qualifiedName: string, publicId: string, systemId: string): IRRDocumentType;
874
- createElement(tagName: string): IRRElement;
875
- createElementNS(_namespaceURI: string, qualifiedName: string): IRRElement;
876
- createTextNode(data: string): IRRText;
877
- createComment(data: string): IRRComment;
878
- createCDATASection(data: string): IRRCDATASection;
879
- open(): void;
880
- close(): void;
881
- write(content: string): void;
882
- }
883
-
884
- declare interface IRRDocumentType extends IRRNode {
885
- readonly name: string;
886
- readonly publicId: string;
887
- readonly systemId: string;
888
- }
889
-
890
- declare interface IRRElement extends IRRNode {
891
- tagName: string;
892
- attributes: Record<string, string>;
893
- shadowRoot: IRRElement | null;
894
- scrollLeft?: number;
895
- scrollTop?: number;
896
- id: string;
897
- className: string;
898
- classList: ClassList;
899
- style: CSSStyleDeclaration_2;
900
- attachShadow(init: ShadowRootInit): IRRElement;
901
- getAttribute(name: string): string | null;
902
- setAttribute(name: string, attribute: string): void;
903
- setAttributeNS(namespace: string | null, qualifiedName: string, value: string): void;
904
- removeAttribute(name: string): void;
905
- dispatchEvent(event: Event): boolean;
906
- }
907
-
908
- declare interface IRRNode {
909
- parentElement: IRRNode | null;
910
- parentNode: IRRNode | null;
911
- ownerDocument: IRRDocument;
912
- readonly childNodes: IRRNode[];
913
- readonly ELEMENT_NODE: number;
914
- readonly TEXT_NODE: number;
915
- readonly nodeType: number;
916
- readonly nodeName: string;
917
- readonly RRNodeType: NodeType;
918
- firstChild: IRRNode | null;
919
- lastChild: IRRNode | null;
920
- previousSibling: IRRNode | null;
921
- nextSibling: IRRNode | null;
922
- textContent: string | null;
923
- contains(node: IRRNode): boolean;
924
- appendChild(newChild: IRRNode): IRRNode;
925
- insertBefore(newChild: IRRNode, refChild: IRRNode | null): IRRNode;
926
- removeChild(node: IRRNode): IRRNode;
927
- toString(): string;
928
- }
929
-
930
- declare interface IRRText extends IRRNode {
931
- readonly nodeName: '#text';
932
- data: string;
933
- }
934
-
935
- declare class Mirror implements IMirror<BaseRRNode> {
936
- private idNodeMap;
937
- private nodeMetaMap;
938
- getId(n: BaseRRNode | undefined | null): number;
939
- getNode(id: number): BaseRRNode | null;
940
- getIds(): number[];
941
- getMeta(n: BaseRRNode): serializedNodeWithId | null;
942
- removeNodeFromMap(n: BaseRRNode): void;
943
- has(id: number): boolean;
944
- hasNode(node: BaseRRNode): boolean;
945
- add(n: BaseRRNode, meta: serializedNodeWithId): void;
946
- replace(id: number, n: BaseRRNode): void;
947
- reset(): void;
948
- }
949
-
950
- declare class RRCanvasElement extends RRElement implements IRRElement {
951
- rr_dataURL: string | null;
952
- canvasMutations: {
953
- event: canvasEventWithTime;
954
- mutation: canvasMutationData;
955
- }[];
956
- getContext(): RenderingContext | null;
957
- }
958
-
959
- declare class RRDocument extends BaseRRDocument {
960
- private UNSERIALIZED_STARTING_ID;
961
- private _unserializedId;
962
- get unserializedId(): number;
963
- mirror: Mirror;
964
- scrollData: scrollData | null;
965
- constructor(mirror?: Mirror);
966
- createDocument(_namespace: string | null, _qualifiedName: string | null, _doctype?: DocumentType | null): RRDocument;
967
- createDocumentType(qualifiedName: string, publicId: string, systemId: string): BaseRRDocumentType;
968
- createElement<K extends keyof HTMLElementTagNameMap>(tagName: K): RRElementType<K>;
969
- createElement(tagName: string): RRElement;
970
- createComment(data: string): BaseRRComment;
971
- createCDATASection(data: string): BaseRRCDATASection;
972
- createTextNode(data: string): BaseRRText;
973
- destroyTree(): void;
974
- open(): void;
975
- }
976
-
977
- declare class RRElement extends BaseRRElement {
978
- inputData: inputData | null;
979
- scrollData: scrollData | null;
980
- }
981
-
982
- declare interface RRElementTagNameMap {
983
- audio: RRMediaElement;
984
- canvas: RRCanvasElement;
985
- iframe: RRIFrameElement;
986
- style: RRStyleElement;
987
- video: RRMediaElement;
988
- }
989
-
990
- declare type RRElementType<K extends keyof HTMLElementTagNameMap> = K extends keyof RRElementTagNameMap ? RRElementTagNameMap[K] : RRElement;
991
-
992
- declare class RRIFrameElement extends RRElement {
993
- contentDocument: RRDocument;
994
- constructor(upperTagName: string, mirror: Mirror);
995
- }
996
-
997
- declare class RRMediaElement extends BaseRRMediaElement {
998
- }
999
-
1000
- declare class RRStyleElement extends RRElement {
1001
- rules: (styleSheetRuleData | styleDeclarationData)[];
661
+ //#region src/document.d.ts
662
+ interface IRRNode {
663
+ parentElement: IRRNode | null;
664
+ parentNode: IRRNode | null;
665
+ ownerDocument: IRRDocument;
666
+ readonly childNodes: IRRNode[];
667
+ readonly ELEMENT_NODE: number;
668
+ readonly TEXT_NODE: number;
669
+ readonly nodeType: number;
670
+ readonly nodeName: string;
671
+ readonly RRNodeType: NodeType;
672
+ firstChild: IRRNode | null;
673
+ lastChild: IRRNode | null;
674
+ previousSibling: IRRNode | null;
675
+ nextSibling: IRRNode | null;
676
+ textContent: string | null;
677
+ contains(node: IRRNode): boolean;
678
+ appendChild(newChild: IRRNode): IRRNode;
679
+ insertBefore(newChild: IRRNode, refChild: IRRNode | null): IRRNode;
680
+ removeChild(node: IRRNode): IRRNode;
681
+ toString(): string;
682
+ }
683
+ interface IRRDocument extends IRRNode {
684
+ documentElement: IRRElement | null;
685
+ body: IRRElement | null;
686
+ head: IRRElement | null;
687
+ implementation: IRRDocument;
688
+ firstElementChild: IRRElement | null;
689
+ readonly nodeName: '#document';
690
+ compatMode: 'BackCompat' | 'CSS1Compat';
691
+ createDocument(_namespace: string | null, _qualifiedName: string | null, _doctype?: DocumentType | null): IRRDocument;
692
+ createDocumentType(qualifiedName: string, publicId: string, systemId: string): IRRDocumentType;
693
+ createElement(tagName: string): IRRElement;
694
+ createElementNS(_namespaceURI: string, qualifiedName: string): IRRElement;
695
+ createTextNode(data: string): IRRText;
696
+ createComment(data: string): IRRComment;
697
+ createCDATASection(data: string): IRRCDATASection;
698
+ open(): void;
699
+ close(): void;
700
+ write(content: string): void;
701
+ }
702
+ interface IRRElement extends IRRNode {
703
+ tagName: string;
704
+ attributes: Record<string, string>;
705
+ shadowRoot: IRRElement | null;
706
+ scrollLeft?: number;
707
+ scrollTop?: number;
708
+ id: string;
709
+ className: string;
710
+ classList: ClassList;
711
+ style: CSSStyleDeclaration;
712
+ attachShadow(init: ShadowRootInit): IRRElement;
713
+ getAttribute(name: string): string | null;
714
+ setAttribute(name: string, attribute: string): void;
715
+ setAttributeNS(namespace: string | null, qualifiedName: string, value: string): void;
716
+ removeAttribute(name: string): void;
717
+ dispatchEvent(event: Event): boolean;
718
+ }
719
+ interface IRRDocumentType extends IRRNode {
720
+ readonly name: string;
721
+ readonly publicId: string;
722
+ readonly systemId: string;
723
+ }
724
+ interface IRRText extends IRRNode {
725
+ readonly nodeName: '#text';
726
+ data: string;
727
+ }
728
+ interface IRRComment extends IRRNode {
729
+ readonly nodeName: '#comment';
730
+ data: string;
731
+ }
732
+ interface IRRCDATASection extends IRRNode {
733
+ readonly nodeName: '#cdata-section';
734
+ data: string;
735
+ }
736
+ declare abstract class BaseRRNode implements IRRNode {
737
+ parentElement: IRRNode | null;
738
+ parentNode: IRRNode | null;
739
+ ownerDocument: IRRDocument;
740
+ firstChild: IRRNode | null;
741
+ lastChild: IRRNode | null;
742
+ previousSibling: IRRNode | null;
743
+ nextSibling: IRRNode | null;
744
+ abstract textContent: string | null;
745
+ readonly ELEMENT_NODE: number;
746
+ readonly TEXT_NODE: number;
747
+ readonly nodeType: number;
748
+ readonly nodeName: string;
749
+ readonly RRNodeType: NodeType;
750
+ constructor(..._args: any[]);
751
+ get childNodes(): IRRNode[];
752
+ contains(node: IRRNode): boolean;
753
+ appendChild(_newChild: IRRNode): IRRNode;
754
+ insertBefore(_newChild: IRRNode, _refChild: IRRNode | null): IRRNode;
755
+ removeChild(_node: IRRNode): IRRNode;
756
+ toString(): string;
757
+ }
758
+ declare class BaseRRDocument extends BaseRRNode implements IRRDocument {
759
+ readonly nodeType: number;
760
+ readonly nodeName: "#document";
761
+ readonly compatMode: 'BackCompat' | 'CSS1Compat';
762
+ readonly RRNodeType = NodeType.Document;
763
+ textContent: string | null;
764
+ constructor(...args: any[]);
765
+ get documentElement(): IRRElement | null;
766
+ get body(): IRRElement | null;
767
+ get head(): IRRElement | null;
768
+ get implementation(): IRRDocument;
769
+ get firstElementChild(): IRRElement | null;
770
+ appendChild(newChild: IRRNode): IRRNode;
771
+ insertBefore(newChild: IRRNode, refChild: IRRNode | null): IRRNode;
772
+ removeChild(node: IRRNode): IRRNode;
773
+ open(): void;
774
+ close(): void;
775
+ write(content: string): void;
776
+ createDocument(_namespace: string | null, _qualifiedName: string | null, _doctype?: DocumentType | null): IRRDocument;
777
+ createDocumentType(qualifiedName: string, publicId: string, systemId: string): IRRDocumentType;
778
+ createElement(tagName: string): IRRElement;
779
+ createElementNS(_namespaceURI: string, qualifiedName: string): IRRElement;
780
+ createTextNode(data: string): IRRText;
781
+ createComment(data: string): IRRComment;
782
+ createCDATASection(data: string): IRRCDATASection;
783
+ toString(): string;
784
+ }
785
+ declare class BaseRRDocumentType extends BaseRRNode implements IRRDocumentType {
786
+ readonly nodeType: number;
787
+ readonly RRNodeType = NodeType.DocumentType;
788
+ readonly nodeName: string;
789
+ readonly name: string;
790
+ readonly publicId: string;
791
+ readonly systemId: string;
792
+ textContent: string | null;
793
+ constructor(qualifiedName: string, publicId: string, systemId: string);
794
+ toString(): string;
795
+ }
796
+ declare class BaseRRElement extends BaseRRNode implements IRRElement {
797
+ readonly nodeType: number;
798
+ readonly RRNodeType = NodeType.Element;
799
+ readonly nodeName: string;
800
+ tagName: string;
801
+ attributes: Record<string, string>;
802
+ shadowRoot: IRRElement | null;
803
+ scrollLeft?: number;
804
+ scrollTop?: number;
805
+ constructor(tagName: string);
806
+ get textContent(): string;
807
+ set textContent(textContent: string);
808
+ get classList(): ClassList;
809
+ get id(): string;
810
+ get className(): string;
811
+ get style(): CSSStyleDeclaration;
812
+ getAttribute(name: string): string | null;
813
+ setAttribute(name: string, attribute: string): void;
814
+ setAttributeNS(_namespace: string | null, qualifiedName: string, value: string): void;
815
+ removeAttribute(name: string): void;
816
+ appendChild(newChild: IRRNode): IRRNode;
817
+ insertBefore(newChild: IRRNode, refChild: IRRNode | null): IRRNode;
818
+ removeChild(node: IRRNode): IRRNode;
819
+ attachShadow(_init: ShadowRootInit): IRRElement;
820
+ dispatchEvent(_event: Event): boolean;
821
+ toString(): string;
822
+ }
823
+ declare class BaseRRMediaElement extends BaseRRElement {
824
+ currentTime?: number;
825
+ volume?: number;
826
+ paused?: boolean;
827
+ muted?: boolean;
828
+ playbackRate?: number;
829
+ loop?: boolean;
830
+ attachShadow(_init: ShadowRootInit): IRRElement;
831
+ play(): void;
832
+ pause(): void;
833
+ }
834
+ declare class BaseRRText extends BaseRRNode implements IRRText {
835
+ readonly nodeType: number;
836
+ readonly nodeName: "#text";
837
+ readonly RRNodeType = NodeType.Text;
838
+ data: string;
839
+ constructor(data: string);
840
+ get textContent(): string;
841
+ set textContent(textContent: string);
842
+ toString(): string;
843
+ }
844
+ declare class BaseRRComment extends BaseRRNode implements IRRComment {
845
+ readonly nodeType: number;
846
+ readonly nodeName: "#comment";
847
+ readonly RRNodeType = NodeType.Comment;
848
+ data: string;
849
+ constructor(data: string);
850
+ get textContent(): string;
851
+ set textContent(textContent: string);
852
+ toString(): string;
853
+ }
854
+ declare class BaseRRCDATASection extends BaseRRNode implements IRRCDATASection {
855
+ readonly nodeName: "#cdata-section";
856
+ readonly nodeType: number;
857
+ readonly RRNodeType = NodeType.CDATA;
858
+ data: string;
859
+ constructor(data: string);
860
+ get textContent(): string;
861
+ set textContent(textContent: string);
862
+ toString(): string;
863
+ }
864
+ declare class ClassList {
865
+ private onChange;
866
+ classes: string[];
867
+ constructor(classText?: string, onChange?: ((newClassText: string) => void) | undefined);
868
+ add: (...classNames: string[]) => void;
869
+ remove: (...classNames: string[]) => void;
870
+ }
871
+ type CSSStyleDeclaration = Record<string, string> & {
872
+ setProperty: (name: string, value: string | null, priority?: string | null) => void;
873
+ removeProperty: (name: string) => string;
874
+ };
875
+ //#endregion
876
+ //#region src/index.d.ts
877
+ declare class RRDocument extends BaseRRDocument {
878
+ private UNSERIALIZED_STARTING_ID;
879
+ private _unserializedId;
880
+ get unserializedId(): number;
881
+ mirror: Mirror;
882
+ scrollData: scrollData | null;
883
+ constructor(mirror?: Mirror);
884
+ createDocument(_namespace: string | null, _qualifiedName: string | null, _doctype?: DocumentType | null): RRDocument;
885
+ createDocumentType(qualifiedName: string, publicId: string, systemId: string): BaseRRDocumentType;
886
+ createElement<K extends keyof HTMLElementTagNameMap>(tagName: K): RRElementType<K>;
887
+ createElement(tagName: string): RRElement;
888
+ createComment(data: string): BaseRRComment;
889
+ createCDATASection(data: string): BaseRRCDATASection;
890
+ createTextNode(data: string): BaseRRText;
891
+ destroyTree(): void;
892
+ open(): void;
893
+ }
894
+ declare class RRElement extends BaseRRElement {
895
+ inputData: inputData | null;
896
+ scrollData: scrollData | null;
897
+ }
898
+ declare class RRMediaElement extends BaseRRMediaElement {}
899
+ declare class RRCanvasElement extends RRElement implements IRRElement {
900
+ rr_dataURL: string | null;
901
+ canvasMutations: {
902
+ event: canvasEventWithTime;
903
+ mutation: canvasMutationData;
904
+ }[];
905
+ getContext(): RenderingContext | null;
906
+ }
907
+ declare class RRStyleElement extends RRElement {
908
+ rules: (styleSheetRuleData | styleDeclarationData)[];
909
+ }
910
+ declare class RRIFrameElement extends RRElement {
911
+ contentDocument: RRDocument;
912
+ constructor(upperTagName: string, mirror: Mirror);
913
+ }
914
+ interface RRElementTagNameMap {
915
+ audio: RRMediaElement;
916
+ canvas: RRCanvasElement;
917
+ iframe: RRIFrameElement;
918
+ style: RRStyleElement;
919
+ video: RRMediaElement;
920
+ }
921
+ type RRElementType<K extends keyof HTMLElementTagNameMap> = K extends keyof RRElementTagNameMap ? RRElementTagNameMap[K] : RRElement;
922
+ declare class Mirror implements IMirror<BaseRRNode> {
923
+ private idNodeMap;
924
+ private nodeMetaMap;
925
+ getId(n: BaseRRNode | undefined | null): number;
926
+ getNode(id: number): BaseRRNode | null;
927
+ getIds(): number[];
928
+ getMeta(n: BaseRRNode): serializedNodeWithId | null;
929
+ removeNodeFromMap(n: BaseRRNode): void;
930
+ has(id: number): boolean;
931
+ hasNode(node: BaseRRNode): boolean;
932
+ add(n: BaseRRNode, meta: serializedNodeWithId): void;
933
+ replace(id: number, n: BaseRRNode): void;
934
+ reset(): void;
1002
935
  }
1003
936
 
1004
937
  declare enum InterpreterStatus {
@@ -1092,445 +1025,382 @@ interface Typestate<TContext extends object> {
1092
1025
  context: TContext;
1093
1026
  }
1094
1027
 
1095
- declare const addCustomEvent: <T>(tag: string, payload: T) => void;
1096
-
1097
- declare type AppendedIframe = {
1098
- mutationInQueue: addedNodeMutation;
1099
- builtNode: HTMLIFrameElement | RRIFrameElement;
1100
- };
1101
-
1102
- declare function callAllSafely(fns: listenerHandler[]): void;
1103
-
1104
- declare function callSafely(fn: () => void): void;
1105
-
1106
- declare function canvasMutation({ event, mutation, target, imageMap, canvasEventMap, errorHandler, }: {
1107
- event: Parameters<Replayer['applyIncremental']>[0];
1108
- mutation: canvasMutationData;
1109
- target: HTMLCanvasElement;
1110
- imageMap: Replayer['imageMap'];
1111
- canvasEventMap: Replayer['canvasEventMap'];
1112
- errorHandler: Replayer['warnCanvasMutationFailed'];
1113
- }): Promise<void>;
1114
-
1115
- declare function closestElementOfNode(node: Node | null): HTMLElement | null;
1116
-
1117
- declare function createPlayerService(context: PlayerContext, { getCastFn, applyEvents, emitter }: PlayerAssets): StateMachine.Service<PlayerContext, PlayerEvent, PlayerState>;
1118
-
1119
- declare function createSpeedService(context: SpeedContext): StateMachine.Service<SpeedContext, SpeedEvent, SpeedState>;
1120
-
1121
-
1122
- declare type ErrorHandler = (error: unknown, context?: ErrorHandlerContext) => void | boolean;
1123
-
1124
- declare type ErrorHandlerContext = 'rrweb' | 'host';
1125
-
1126
-
1127
- declare const freezePage: () => void;
1128
-
1129
- declare function getBaseDimension(node: Node, rootIframe: Node): DocumentDimension;
1130
-
1131
-
1132
- declare function getNestedRule(rules: CSSRuleList, position: number[]): CSSGroupingRule | null;
1133
-
1134
- declare function getPositionsAndIndex(nestedIndex: number[]): {
1135
- positions: number[];
1136
- index: number | undefined;
1137
- };
1138
-
1139
- declare function getRootShadowHost(n: Node): Node;
1140
-
1141
- declare function getShadowHost(n: Node): Element | null;
1142
-
1143
- declare function getWindowHeight(): number;
1144
-
1145
- declare function getWindowScroll(win: Window): {
1146
- left: number;
1147
- top: number;
1148
- };
1149
-
1150
- declare function getWindowWidth(): number;
1151
-
1152
- declare function hasShadowRoot<T extends Node | BaseRRNode>(n: T): n is T & {
1153
- shadowRoot: ShadowRoot;
1154
- };
1155
-
1156
- declare function hookSetter<T>(target: T, key: string | number | symbol, d: PropertyDescriptor, isRevoked?: boolean, win?: Window & typeof globalThis): hookResetter;
1157
-
1158
-
1159
- declare function inDom(n: Node): boolean;
1160
-
1161
- declare function isAncestorRemoved(target: Node, mirror: Mirror$1): boolean;
1162
-
1163
- declare function isBlocked(node: Node | null, blockClass: blockClass, blockSelector: string | null, checkAncestors: boolean): boolean;
1164
-
1165
- declare function isIgnored(n: Node, mirror: Mirror$1, slimDOMOptions: SlimDOMOptions): boolean;
1166
-
1167
- declare function isSerialized(n: Node, mirror: Mirror$1): boolean;
1168
-
1169
- declare function isSerializedIframe<TNode extends Node | BaseRRNode>(n: TNode, mirror: IMirror<TNode>): boolean;
1170
-
1171
- declare function isSerializedStylesheet<TNode extends Node | BaseRRNode>(n: TNode, mirror: IMirror<TNode>): boolean;
1172
-
1173
- declare function iterateResolveTree(tree: ResolveTree, cb: (mutation: addedNodeMutation) => unknown): void;
1174
-
1175
- declare function legacy_isTouchEvent(event: MouseEvent | TouchEvent | PointerEvent): event is TouchEvent;
1176
-
1177
- declare let mirror: DeprecatedMirror;
1178
-
1179
-
1180
- declare let nowTimestamp: () => number;
1181
-
1182
- declare function on(type: string, fn: EventListenerOrEventListenerObject, target?: Document | IWindow): listenerHandler;
1183
-
1184
- declare type PlayerAssets = {
1185
- emitter: Emitter;
1186
- applyEvents(events: Array<eventWithTime>, onApplied: () => void): void;
1187
- getCastFn(event: eventWithTime, isSync: boolean): () => void;
1188
- };
1189
-
1190
- declare type playerConfig = {
1191
- speed: number;
1192
- maxSpeed: number;
1193
- root: Element;
1194
- loadTimeout: number;
1195
- skipInactive: boolean;
1196
- inactivePeriodThreshold: number;
1197
- showWarning: boolean;
1198
- showDebug: boolean;
1199
- blockClass: string;
1200
- liveMode: boolean;
1201
- insertStyleRules: string[];
1202
- triggerFocus: boolean;
1203
- UNSAFE_replayCanvas: boolean;
1204
- pauseAnimation?: boolean;
1205
- mouseTail: boolean | {
1206
- duration?: number;
1207
- lineCap?: string;
1208
- lineWidth?: number;
1209
- strokeStyle?: string;
1210
- };
1211
- unpackFn?: UnpackFn;
1212
- useVirtualDom: boolean;
1213
- seekYieldBudgetMs?: number;
1214
- logger: {
1215
- log: (...args: Parameters<typeof console.log>) => void;
1216
- warn: (...args: Parameters<typeof console.warn>) => void;
1217
- };
1218
- plugins?: ReplayPlugin[];
1219
- };
1220
-
1221
- declare type PlayerContext = {
1222
- events: eventWithTime[];
1223
- timer: Timer;
1224
- timeOffset: number;
1225
- baselineTime: number;
1226
- lastPlayedEvent: eventWithTime | null;
1227
- };
1228
-
1229
- declare type PlayerEvent = {
1230
- type: 'PLAY';
1231
- payload: {
1232
- timeOffset: number;
1233
- };
1234
- } | {
1235
- type: 'CAST_EVENT';
1236
- payload: {
1237
- event: eventWithTime;
1238
- };
1239
- } | {
1240
- type: 'PAUSE';
1241
- } | {
1242
- type: 'RESET_LAST_PLAYED';
1243
- } | {
1244
- type: 'TO_LIVE';
1245
- payload: {
1246
- baselineTime?: number;
1247
- };
1248
- } | {
1249
- type: 'ADD_EVENT';
1250
- payload: {
1251
- event: eventWithTime;
1252
- applyPastEventSynchronously?: boolean;
1253
- };
1254
- } | {
1255
- type: 'END';
1256
- };
1257
-
1258
- declare type PlayerMachineState = StateMachine.State<PlayerContext, PlayerEvent, PlayerState>;
1259
-
1260
- declare type PlayerState = {
1261
- value: 'playing';
1262
- context: PlayerContext;
1263
- } | {
1264
- value: 'paused';
1265
- context: PlayerContext;
1266
- } | {
1267
- value: 'live';
1268
- context: PlayerContext;
1269
- };
1270
-
1271
- declare function polyfill(win?: Window & typeof globalThis): void;
1272
-
1273
- declare function queueToResolveTrees(queue: addedNodeMutation[]): ResolveTree[];
1274
-
1275
- declare type recordOptions<T> = {
1276
- emit?: (e: T, isCheckout?: boolean) => void;
1277
- checkoutEveryNth?: number;
1278
- checkoutEveryNms?: number;
1279
- blockClass?: blockClass;
1280
- blockSelector?: string;
1281
- ignoreClass?: string;
1282
- ignoreSelector?: string;
1283
- maskTextClass?: maskTextClass;
1284
- maskTextSelector?: string;
1285
- maskAllInputs?: boolean;
1286
- maskInputOptions?: MaskInputOptions;
1287
- maskInputFn?: MaskInputFn;
1288
- maskTextFn?: MaskTextFn;
1289
- maskAllElementAttributes?: boolean;
1290
- maskAttributeFn?: MaskAttributeFn;
1291
- slimDOMOptions?: SlimDOMOptions | 'all' | true;
1292
- ignoreCSSAttributes?: Set<string>;
1293
- attributeFilter?: string[];
1294
- inlineStylesheet?: boolean;
1295
- inlineStylesheetBudgetRules?: number;
1296
- hooks?: hooksParam;
1297
- packFn?: PackFn;
1298
- sampling?: SamplingStrategy;
1299
- dataURLOptions?: DataURLOptions;
1300
- canvasResolutionScale?: number;
1301
- canvasMasking?: CanvasMasking;
1302
- recordDOM?: boolean;
1303
- recordCanvas?: boolean;
1304
- recordCrossOriginIframes?: boolean;
1305
- recordAfter?: 'DOMContentLoaded' | 'load';
1306
- userTriggeredOnInput?: boolean;
1307
- collectFonts?: boolean;
1308
- inlineImages?: boolean;
1309
- plugins?: RecordPlugin[];
1310
- mousemoveWait?: number;
1311
- keepIframeSrcFn?: KeepIframeSrcFn;
1312
- errorHandler?: ErrorHandler;
1313
- };
1314
-
1315
- declare function removeEventListenerSafely(target: Pick<EventTarget, 'removeEventListener'>, type: string, fn: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
1316
-
1317
- declare class Replayer {
1318
- wrapper: HTMLDivElement;
1319
- iframe: HTMLIFrameElement;
1320
- service: ReturnType<typeof createPlayerService>;
1321
- speedService: ReturnType<typeof createSpeedService>;
1322
- get timer(): Timer;
1323
- config: playerConfig;
1324
- usingVirtualDom: boolean;
1325
- virtualDom: RRDocument;
1326
- private mouse;
1327
- private mouseTail;
1328
- private tailPositions;
1329
- private emitter;
1330
- private nextUserInteractionEvent;
1331
- private legacy_missingNodeRetryMap;
1332
- private cache;
1333
- private imageMap;
1334
- private canvasEventMap;
1335
- private mirror;
1336
- private styleMirror;
1337
- private pendingAdoptedStyleSheets;
1338
- private lastAdoptedStyleIds;
1339
- private adoptedStyleSheetTokens;
1340
- private mediaManager;
1341
- private firstFullSnapshot;
1342
- private newDocumentQueue;
1343
- private mousePos;
1344
- private touchActive;
1345
- private lastMouseDownEvent;
1346
- private lastHoveredRootNode;
1347
- private lastSelectionData;
1348
- private lastScrollMap;
1349
- private constructedStyleMutations;
1350
- private adoptedStyleSheets;
1351
- private emitterHandlers;
1352
- private serviceSubscription?;
1353
- private speedServiceSubscription?;
1354
- private timeouts;
1355
- private applyGeneration;
1356
- private seekRebuildInFlight;
1357
- private styleSheetLoadListeners;
1358
- constructor(events: Array<eventWithTime | string>, config?: Partial<playerConfig>);
1359
- on(event: string, handler: Handler): this;
1360
- off(event: string, handler: Handler): this;
1361
- private addEmitterHandler;
1362
- private addTimeout;
1363
- setConfig(config: Partial<playerConfig>): void;
1364
- getMetaData(): playerMetaData;
1365
- getCurrentTime(): number;
1366
- getTimeOffset(): number;
1367
- getMirror(): Mirror$1;
1368
- play(timeOffset?: number): void;
1369
- pause(timeOffset?: number): void;
1370
- resume(timeOffset?: number): void;
1371
- destroy(): void;
1372
- startLive(baselineTime?: number): void;
1373
- addEvent(rawEvent: eventWithTime | string): void;
1374
- enableInteract(): void;
1375
- disableInteract(): void;
1376
- resetCache(): void;
1377
- private setupDom;
1378
- private handleResize;
1379
- private applyFullscreen;
1380
- private clearFullscreen;
1381
- private shouldCastInSyncMode;
1382
- private discardStaleFlushBuffers;
1383
- private applyEvents;
1384
- private getCastFn;
1385
- private rebuildFullSnapshot;
1386
- private insertStyleRules;
1387
- private attachDocumentToIframe;
1388
- private collectIframeAndAttachDocument;
1389
- private waitForStylesheetLoad;
1390
- private preloadAllImages;
1391
- private preloadImages;
1392
- private deserializeAndPreloadCanvasEvents;
1393
- private applyIncremental;
1394
- private applyMutation;
1395
- private applyScroll;
1396
- private applyInput;
1397
- private applySelection;
1398
- private applyStyleSheetMutation;
1399
- private applyStyleSheetRule;
1400
- private applyStyleDeclaration;
1401
- private applyAdoptedStyleSheet;
1402
- private legacy_resolveMissingNode;
1403
- private moveAndHover;
1404
- private drawMouseTail;
1405
- private hoverElements;
1406
- private isUserInteraction;
1407
- private backToNormal;
1408
- private warnNodeNotFound;
1409
- private warnCanvasMutationFailed;
1410
- private debugNodeNotFound;
1411
- private warn;
1412
- private debug;
1413
- }
1414
-
1415
-
1416
- declare type ReplayPlugin = {
1417
- handler?: (event: eventWithTime, isSync: boolean, context: {
1418
- replayer: Replayer;
1419
- }) => void;
1420
- onBuild?: (node: Node | BaseRRNode, context: {
1421
- id: number;
1422
- replayer: Replayer;
1423
- }) => void;
1424
- getMirror?: (mirrors: {
1425
- nodeMirror: Mirror$1;
1426
- }) => void;
1427
- };
1428
-
1429
-
1430
- declare type ResolveTree = {
1431
- value: addedNodeMutation;
1432
- children: ResolveTree[];
1433
- parent: ResolveTree | null;
1434
- };
1435
-
1436
- declare function shadowHostInDom(n: Node): boolean;
1437
-
1438
-
1439
- declare type SpeedContext = {
1440
- normalSpeed: playerConfig['speed'];
1441
- timer: Timer;
1442
- };
1443
-
1444
- declare type SpeedEvent = {
1445
- type: 'FAST_FORWARD';
1446
- payload: {
1447
- speed: playerConfig['speed'];
1448
- };
1449
- } | {
1450
- type: 'BACK_TO_NORMAL';
1451
- } | {
1452
- type: 'SET_SPEED';
1453
- payload: {
1454
- speed: playerConfig['speed'];
1455
- };
1456
- };
1457
-
1458
- declare type SpeedMachineState = StateMachine.State<SpeedContext, SpeedEvent, SpeedState>;
1459
-
1460
- declare type SpeedState = {
1461
- value: 'normal';
1462
- context: SpeedContext;
1463
- } | {
1464
- value: 'skipping';
1465
- context: SpeedContext;
1466
- };
1467
-
1468
- declare class StyleSheetMirror {
1469
- private id;
1470
- private styleIDMap;
1471
- private idStyleMap;
1472
- getId(stylesheet: CSSStyleSheet): number;
1473
- has(stylesheet: CSSStyleSheet): boolean;
1474
- add(stylesheet: CSSStyleSheet, id?: number): number;
1475
- getStyle(id: number): CSSStyleSheet | null;
1476
- reset(): void;
1477
- generateId(): number;
1478
- }
1479
-
1480
- declare const takeFullSnapshot: (isCheckout?: boolean) => void;
1481
-
1482
- declare function throttle<T>(func: (arg: T) => void, wait: number, options?: throttleOptions): (...args: T[]) => void;
1483
-
1484
- declare class Timer {
1485
- timeOffset: number;
1486
- speed: number;
1487
- private actions;
1488
- private raf;
1489
- private lastTimestamp;
1490
- constructor(actions: actionWithDelay[] | undefined, config: {
1491
- speed: number;
1492
- });
1493
- addAction(action: actionWithDelay): void;
1494
- start(): void;
1495
- private rafCheck;
1496
- clear(): void;
1497
- setSpeed(speed: number): void;
1498
- isActive(): boolean;
1499
- private findActionIndex;
1500
- }
1501
-
1502
- declare function uniqueTextMutations(mutations: textMutation[]): textMutation[];
1503
-
1504
- declare namespace utils {
1505
- export { on, removeEventListenerSafely, callSafely, callAllSafely, throttle, hookSetter, getWindowScroll, getWindowHeight, getWindowWidth, closestElementOfNode, isBlocked, isSerialized, isIgnored, isAncestorRemoved, legacy_isTouchEvent, polyfill, queueToResolveTrees, iterateResolveTree, isSerializedIframe, isSerializedStylesheet, getBaseDimension, hasShadowRoot, getNestedRule, getPositionsAndIndex, uniqueTextMutations, getShadowHost, getRootShadowHost, shadowHostInDom, inDom, mirror as _mirror, nowTimestamp, StyleSheetMirror };
1506
- export type { AppendedIframe };
1507
- }
1508
-
1509
-
1510
- declare function record<T = eventWithTime>(options?: recordOptions<T>): listenerHandler | undefined;
1511
-
1512
- declare namespace record {
1513
- var addCustomEvent: <T>(tag: string, payload: T) => void;
1514
- var freezePage: () => void;
1515
- var takeFullSnapshot: (isCheckout?: boolean) => void;
1516
- var mirror: Mirror$1;
1517
- }
1518
-
1519
-
1520
- declare namespace record {
1521
- var addCustomEvent: <T>(tag: string, payload: T) => void;
1522
- var freezePage: () => void;
1523
- var takeFullSnapshot: (isCheckout?: boolean) => void;
1524
- var mirror: Mirror$1;
1028
+ declare namespace utils_d_exports {
1029
+ export { StyleSheetMirror, _mirror, callAllSafely, callSafely, closestElementOfNode, getBaseDimension, getNestedRule, getPositionsAndIndex, getRootShadowHost, getShadowHost, getWindowHeight, getWindowScroll, getWindowWidth, hasShadowRoot, hookSetter, inDom, isAncestorRemoved, isBlocked, isIgnored, isSerialized, isSerializedIframe, isSerializedStylesheet, iterateResolveTree, legacy_isTouchEvent, nowTimestamp, on, polyfill, queueToResolveTrees, removeEventListenerSafely, shadowHostInDom, throttle, uniqueTextMutations };
1030
+ export type { AppendedIframe };
1525
1031
  }
1526
-
1527
-
1032
+ declare function on(type: string, fn: EventListenerOrEventListenerObject, target?: Document | IWindow): listenerHandler;
1033
+ declare function removeEventListenerSafely(target: Pick<EventTarget, 'removeEventListener'>, type: string, fn: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
1034
+ declare function callSafely(fn: () => void): void;
1035
+ declare function callAllSafely(fns: listenerHandler[]): void;
1036
+ declare let _mirror: DeprecatedMirror;
1037
+ declare function throttle<T>(func: (arg: T) => void, wait: number, options?: throttleOptions): (...args: T[]) => void;
1038
+ declare function hookSetter<T>(target: T, key: string | number | symbol, d: PropertyDescriptor, isRevoked?: boolean, win?: Window & typeof globalThis): hookResetter;
1039
+ declare let nowTimestamp: () => number;
1040
+ declare function getWindowScroll(win: Window): {
1041
+ left: number;
1042
+ top: number;
1043
+ };
1044
+ declare function getWindowHeight(): number;
1045
+ declare function getWindowWidth(): number;
1046
+ declare function closestElementOfNode(node: Node | null): HTMLElement | null;
1047
+ declare function isBlocked(node: Node | null, blockClass: blockClass, blockSelector: string | null, checkAncestors: boolean): boolean;
1048
+ declare function isSerialized(n: Node, mirror: Mirror$1): boolean;
1049
+ declare function isIgnored(n: Node, mirror: Mirror$1, slimDOMOptions: SlimDOMOptions): boolean;
1050
+ declare function isAncestorRemoved(target: Node, mirror: Mirror$1): boolean;
1051
+ declare function legacy_isTouchEvent(event: MouseEvent | TouchEvent | PointerEvent): event is TouchEvent;
1052
+ declare function polyfill(win?: Window & typeof globalThis): void;
1053
+ type ResolveTree = {
1054
+ value: addedNodeMutation;
1055
+ children: ResolveTree[];
1056
+ parent: ResolveTree | null;
1057
+ };
1058
+ declare function queueToResolveTrees(queue: addedNodeMutation[]): ResolveTree[];
1059
+ declare function iterateResolveTree(tree: ResolveTree, cb: (mutation: addedNodeMutation) => unknown): void;
1060
+ type AppendedIframe = {
1061
+ mutationInQueue: addedNodeMutation;
1062
+ builtNode: HTMLIFrameElement | RRIFrameElement;
1063
+ };
1064
+ declare function isSerializedIframe<TNode extends Node | BaseRRNode>(n: TNode, mirror: IMirror<TNode>): boolean;
1065
+ declare function isSerializedStylesheet<TNode extends Node | BaseRRNode>(n: TNode, mirror: IMirror<TNode>): boolean;
1066
+ declare function getBaseDimension(node: Node, rootIframe: Node): DocumentDimension;
1067
+ declare function hasShadowRoot<T extends Node | BaseRRNode>(n: T): n is T & {
1068
+ shadowRoot: ShadowRoot;
1069
+ };
1070
+ declare function getNestedRule(rules: CSSRuleList, position: number[]): CSSGroupingRule | null;
1071
+ declare function getPositionsAndIndex(nestedIndex: number[]): {
1072
+ positions: number[];
1073
+ index: number | undefined;
1074
+ };
1075
+ declare function uniqueTextMutations(mutations: textMutation[]): textMutation[];
1076
+ declare class StyleSheetMirror {
1077
+ private id;
1078
+ private styleIDMap;
1079
+ private idStyleMap;
1080
+ getId(stylesheet: CSSStyleSheet): number;
1081
+ has(stylesheet: CSSStyleSheet): boolean;
1082
+ add(stylesheet: CSSStyleSheet, id?: number): number;
1083
+ getStyle(id: number): CSSStyleSheet | null;
1084
+ reset(): void;
1085
+ generateId(): number;
1086
+ }
1087
+ declare function getShadowHost(n: Node): Element | null;
1088
+ declare function getRootShadowHost(n: Node): Node;
1089
+ declare function shadowHostInDom(n: Node): boolean;
1090
+ declare function inDom(n: Node): boolean;
1091
+ //#endregion
1092
+ //#region src/replay/timer.d.ts
1093
+ declare class Timer {
1094
+ timeOffset: number;
1095
+ speed: number;
1096
+ private actions;
1097
+ private raf;
1098
+ private lastTimestamp;
1099
+ constructor(actions: actionWithDelay[] | undefined, config: {
1100
+ speed: number;
1101
+ });
1102
+ addAction(action: actionWithDelay): void;
1103
+ start(): void;
1104
+ private rafCheck;
1105
+ clear(): void;
1106
+ setSpeed(speed: number): void;
1107
+ isActive(): boolean;
1108
+ private findActionIndex;
1109
+ }
1110
+ //#endregion
1111
+ //#region src/replay/machine.d.ts
1112
+ type PlayerContext = {
1113
+ events: eventWithTime[];
1114
+ timer: Timer;
1115
+ timeOffset: number;
1116
+ baselineTime: number;
1117
+ lastPlayedEvent: eventWithTime | null;
1118
+ };
1119
+ type PlayerEvent = {
1120
+ type: 'PLAY';
1121
+ payload: {
1122
+ timeOffset: number;
1123
+ };
1124
+ } | {
1125
+ type: 'CAST_EVENT';
1126
+ payload: {
1127
+ event: eventWithTime;
1128
+ };
1129
+ } | {
1130
+ type: 'PAUSE';
1131
+ } | {
1132
+ type: 'RESET_LAST_PLAYED';
1133
+ } | {
1134
+ type: 'TO_LIVE';
1135
+ payload: {
1136
+ baselineTime?: number;
1137
+ };
1138
+ } | {
1139
+ type: 'ADD_EVENT';
1140
+ payload: {
1141
+ event: eventWithTime;
1142
+ applyPastEventSynchronously?: boolean;
1143
+ };
1144
+ } | {
1145
+ type: 'END';
1146
+ };
1147
+ type PlayerState = {
1148
+ value: 'playing';
1149
+ context: PlayerContext;
1150
+ } | {
1151
+ value: 'paused';
1152
+ context: PlayerContext;
1153
+ } | {
1154
+ value: 'live';
1155
+ context: PlayerContext;
1156
+ };
1157
+ type PlayerAssets = {
1158
+ emitter: Emitter;
1159
+ applyEvents(events: Array<eventWithTime>, onApplied: () => void): void;
1160
+ getCastFn(event: eventWithTime, isSync: boolean): () => void;
1161
+ };
1162
+ declare function createPlayerService(context: PlayerContext, { getCastFn, applyEvents, emitter }: PlayerAssets): StateMachine.Service<PlayerContext, PlayerEvent, PlayerState>;
1163
+ type SpeedContext = {
1164
+ normalSpeed: playerConfig['speed'];
1165
+ timer: Timer;
1166
+ };
1167
+ type SpeedEvent = {
1168
+ type: 'FAST_FORWARD';
1169
+ payload: {
1170
+ speed: playerConfig['speed'];
1171
+ };
1172
+ } | {
1173
+ type: 'BACK_TO_NORMAL';
1174
+ } | {
1175
+ type: 'SET_SPEED';
1176
+ payload: {
1177
+ speed: playerConfig['speed'];
1178
+ };
1179
+ };
1180
+ type SpeedState = {
1181
+ value: 'normal';
1182
+ context: SpeedContext;
1183
+ } | {
1184
+ value: 'skipping';
1185
+ context: SpeedContext;
1186
+ };
1187
+ declare function createSpeedService(context: SpeedContext): StateMachine.Service<SpeedContext, SpeedEvent, SpeedState>;
1188
+ type PlayerMachineState = StateMachine.State<PlayerContext, PlayerEvent, PlayerState>;
1189
+ type SpeedMachineState = StateMachine.State<SpeedContext, SpeedEvent, SpeedState>;
1190
+ //#endregion
1191
+ //#region src/replay/index.d.ts
1192
+ declare class Replayer {
1193
+ wrapper: HTMLDivElement;
1194
+ iframe: HTMLIFrameElement;
1195
+ service: ReturnType<typeof createPlayerService>;
1196
+ speedService: ReturnType<typeof createSpeedService>;
1197
+ get timer(): Timer;
1198
+ config: playerConfig;
1199
+ usingVirtualDom: boolean;
1200
+ virtualDom: RRDocument;
1201
+ private mouse;
1202
+ private mouseTail;
1203
+ private tailPositions;
1204
+ private emitter;
1205
+ private nextUserInteractionEvent;
1206
+ private legacy_missingNodeRetryMap;
1207
+ private cache;
1208
+ private imageMap;
1209
+ private canvasEventMap;
1210
+ private mirror;
1211
+ private styleMirror;
1212
+ private pendingAdoptedStyleSheets;
1213
+ private lastAdoptedStyleIds;
1214
+ private adoptedStyleSheetTokens;
1215
+ private mediaManager;
1216
+ private firstFullSnapshot;
1217
+ private newDocumentQueue;
1218
+ private mousePos;
1219
+ private touchActive;
1220
+ private lastMouseDownEvent;
1221
+ private lastHoveredRootNode;
1222
+ private lastSelectionData;
1223
+ private lastScrollMap;
1224
+ private constructedStyleMutations;
1225
+ private adoptedStyleSheets;
1226
+ private emitterHandlers;
1227
+ private serviceSubscription?;
1228
+ private speedServiceSubscription?;
1229
+ private timeouts;
1230
+ private applyGeneration;
1231
+ private seekRebuildInFlight;
1232
+ private styleSheetLoadListeners;
1233
+ constructor(events: Array<eventWithTime | string>, config?: Partial<playerConfig>);
1234
+ on(event: string, handler: Handler): this;
1235
+ off(event: string, handler: Handler): this;
1236
+ private addEmitterHandler;
1237
+ private addTimeout;
1238
+ setConfig(config: Partial<playerConfig>): void;
1239
+ getMetaData(): playerMetaData;
1240
+ getCurrentTime(): number;
1241
+ getTimeOffset(): number;
1242
+ getMirror(): Mirror$1;
1243
+ play(timeOffset?: number): void;
1244
+ pause(timeOffset?: number): void;
1245
+ resume(timeOffset?: number): void;
1246
+ destroy(): void;
1247
+ startLive(baselineTime?: number): void;
1248
+ addEvent(rawEvent: eventWithTime | string): void;
1249
+ enableInteract(): void;
1250
+ disableInteract(): void;
1251
+ resetCache(): void;
1252
+ private setupDom;
1253
+ private handleResize;
1254
+ private applyFullscreen;
1255
+ private clearFullscreen;
1256
+ private shouldCastInSyncMode;
1257
+ private discardStaleFlushBuffers;
1258
+ private applyEvents;
1259
+ private getCastFn;
1260
+ private rebuildFullSnapshot;
1261
+ private insertStyleRules;
1262
+ private attachDocumentToIframe;
1263
+ private collectIframeAndAttachDocument;
1264
+ private waitForStylesheetLoad;
1265
+ private preloadAllImages;
1266
+ private preloadImages;
1267
+ private deserializeAndPreloadCanvasEvents;
1268
+ private applyIncremental;
1269
+ private applyMutation;
1270
+ private applyScroll;
1271
+ private applyInput;
1272
+ private applySelection;
1273
+ private applyStyleSheetMutation;
1274
+ private applyStyleSheetRule;
1275
+ private applyStyleDeclaration;
1276
+ private applyAdoptedStyleSheet;
1277
+ private legacy_resolveMissingNode;
1278
+ private moveAndHover;
1279
+ private drawMouseTail;
1280
+ private hoverElements;
1281
+ private isUserInteraction;
1282
+ private backToNormal;
1283
+ private warnNodeNotFound;
1284
+ private warnCanvasMutationFailed;
1285
+ private debugNodeNotFound;
1286
+ private warn;
1287
+ private debug;
1288
+ }
1289
+ //#endregion
1290
+ //#region src/types.d.ts
1291
+ type recordOptions<T> = {
1292
+ emit?: (e: T, isCheckout?: boolean) => void;
1293
+ checkoutEveryNth?: number;
1294
+ checkoutEveryNms?: number;
1295
+ blockClass?: blockClass;
1296
+ blockSelector?: string;
1297
+ ignoreClass?: string;
1298
+ ignoreSelector?: string;
1299
+ maskTextClass?: maskTextClass;
1300
+ maskTextSelector?: string;
1301
+ maskAllInputs?: boolean;
1302
+ maskInputOptions?: MaskInputOptions;
1303
+ maskInputFn?: MaskInputFn;
1304
+ maskTextFn?: MaskTextFn;
1305
+ maskAllElementAttributes?: boolean;
1306
+ maskAttributeFn?: MaskAttributeFn;
1307
+ slimDOMOptions?: SlimDOMOptions | 'all' | true;
1308
+ ignoreCSSAttributes?: Set<string>;
1309
+ attributeFilter?: string[];
1310
+ inlineStylesheet?: boolean;
1311
+ inlineStylesheetBudgetRules?: number;
1312
+ hooks?: hooksParam;
1313
+ packFn?: PackFn;
1314
+ sampling?: SamplingStrategy;
1315
+ dataURLOptions?: DataURLOptions;
1316
+ canvasResolutionScale?: number;
1317
+ canvasMasking?: CanvasMasking;
1318
+ recordDOM?: boolean;
1319
+ recordCanvas?: boolean;
1320
+ recordCrossOriginIframes?: boolean;
1321
+ recordAfter?: 'DOMContentLoaded' | 'load';
1322
+ userTriggeredOnInput?: boolean;
1323
+ collectFonts?: boolean;
1324
+ inlineImages?: boolean;
1325
+ plugins?: RecordPlugin[];
1326
+ mousemoveWait?: number;
1327
+ keepIframeSrcFn?: KeepIframeSrcFn;
1328
+ errorHandler?: ErrorHandler;
1329
+ };
1330
+ type ReplayPlugin = {
1331
+ handler?: (event: eventWithTime, isSync: boolean, context: {
1332
+ replayer: Replayer;
1333
+ }) => void;
1334
+ onBuild?: (node: Node | BaseRRNode, context: {
1335
+ id: number;
1336
+ replayer: Replayer;
1337
+ }) => void;
1338
+ getMirror?: (mirrors: {
1339
+ nodeMirror: Mirror$1;
1340
+ }) => void;
1341
+ };
1342
+ type playerConfig = {
1343
+ speed: number;
1344
+ maxSpeed: number;
1345
+ root: Element;
1346
+ loadTimeout: number;
1347
+ skipInactive: boolean;
1348
+ inactivePeriodThreshold: number;
1349
+ showWarning: boolean;
1350
+ showDebug: boolean;
1351
+ blockClass: string;
1352
+ liveMode: boolean;
1353
+ insertStyleRules: string[];
1354
+ triggerFocus: boolean;
1355
+ UNSAFE_replayCanvas: boolean;
1356
+ pauseAnimation?: boolean;
1357
+ mouseTail: boolean | {
1358
+ duration?: number;
1359
+ lineCap?: string;
1360
+ lineWidth?: number;
1361
+ strokeStyle?: string;
1362
+ };
1363
+ unpackFn?: UnpackFn;
1364
+ useVirtualDom: boolean;
1365
+ seekYieldBudgetMs?: number;
1366
+ logger: {
1367
+ log: (...args: Parameters<typeof console.log>) => void;
1368
+ warn: (...args: Parameters<typeof console.warn>) => void;
1369
+ };
1370
+ plugins?: ReplayPlugin[];
1371
+ };
1528
1372
  declare global {
1529
- interface Window {
1530
- FontFace: typeof FontFace;
1531
- Array: typeof Array;
1532
- }
1373
+ interface Window {
1374
+ FontFace: typeof FontFace;
1375
+ Array: typeof Array;
1376
+ }
1377
+ }
1378
+ type ErrorHandlerContext = 'rrweb' | 'host';
1379
+ type ErrorHandler = (error: unknown, context?: ErrorHandlerContext) => void | boolean;
1380
+ //#endregion
1381
+ //#region src/record/index.d.ts
1382
+ declare function record<T = eventWithTime>(options?: recordOptions<T>): listenerHandler | undefined;
1383
+ declare namespace record {
1384
+ var addCustomEvent: <T>(tag: string, payload: T) => void;
1385
+ var freezePage: () => void;
1386
+ var takeFullSnapshot: (isCheckout?: boolean) => void;
1387
+ var mirror: Mirror$1;
1533
1388
  }
1389
+ //#endregion
1390
+ //#region src/replay/canvas/index.d.ts
1391
+ declare function canvasMutation({ event, mutation, target, imageMap, canvasEventMap, errorHandler }: {
1392
+ event: Parameters<Replayer['applyIncremental']>[0];
1393
+ mutation: canvasMutationData;
1394
+ target: HTMLCanvasElement;
1395
+ imageMap: Replayer['imageMap'];
1396
+ canvasEventMap: Replayer['canvasEventMap'];
1397
+ errorHandler: Replayer['warnCanvasMutationFailed'];
1398
+ }): Promise<void>;
1399
+ //#endregion
1400
+ //#region src/index.d.ts
1401
+ declare const addCustomEvent: <T>(tag: string, payload: T) => void;
1402
+ declare const freezePage: () => void;
1403
+ declare const takeFullSnapshot: (isCheckout?: boolean) => void;
1534
1404
 
1535
- export { EventType, IncrementalSource, MouseInteractions, Replayer, ReplayerEvents, addCustomEvent, canvasMutation, freezePage, getDeferredStylesheetStats, getDiscardedDurationSamples, getLastSnapshotCost, getMutationCost, mirror, record, resetMaxDepthState, resetSnapshotCostState, takeFullSnapshot, utils, wasMaxDepthReached };
1405
+ export { EventType, IncrementalSource, MouseInteractions, Replayer, ReplayerEvents, addCustomEvent, canvasMutation, freezePage, getDeferredStylesheetStats, getDiscardedDurationSamples, getLastSnapshotCost, getMutationCost, _mirror as mirror, record, resetMaxDepthState, resetSnapshotCostState, takeFullSnapshot, utils_d_exports as utils, wasMaxDepthReached };
1536
1406
  export type { DeferredStylesheetStats, MutationCost, PlayerMachineState, ReplayPlugin, SnapshotCost, SpeedMachineState, eventWithTime, playerConfig, recordOptions };