@appsurify-testmap/rrweb-record 2.0.0-alpha.21 → 2.0.0-alpha.23

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.
@@ -202,23 +202,71 @@ const index$1 = {
202
202
  querySelectorAll: querySelectorAll$1,
203
203
  mutationObserver: mutationObserverCtor$1
204
204
  };
205
- function getXPath(n2) {
206
- if (n2.id) {
207
- return `//*[@id="${n2.id}"]`;
205
+ function getXPath(node2) {
206
+ if (node2.nodeType === Node.DOCUMENT_NODE) {
207
+ return "/";
208
208
  }
209
- if (n2 === document.body) {
210
- return "/html/body";
209
+ if (node2.nodeType === Node.DOCUMENT_TYPE_NODE) {
210
+ return "/html/doctype";
211
211
  }
212
- const parentNode2 = index$1.parentNode(n2);
213
- if (!parentNode2 || !(parentNode2 instanceof Element)) {
214
- return "";
212
+ if (node2.nodeType === Node.ELEMENT_NODE) {
213
+ const element = node2;
214
+ if (element.id) {
215
+ return `//*[@id="${element.id}"]`;
216
+ }
217
+ if (element.tagName && element.tagName.toLowerCase() === "html") {
218
+ return "/html";
219
+ }
220
+ if (element === document.head) {
221
+ return "/html/head";
222
+ }
223
+ if (element === document.body) {
224
+ return "/html/body";
225
+ }
226
+ const parentNode2 = element.parentNode;
227
+ if (!parentNode2 || !(parentNode2 instanceof Element)) {
228
+ return "";
229
+ }
230
+ const siblings = Array.from(parentNode2.children).filter(
231
+ (sibling) => sibling.tagName === element.tagName
232
+ );
233
+ const index2 = siblings.length > 1 ? `[${siblings.indexOf(element) + 1}]` : "";
234
+ return `${getXPath(parentNode2)}/${element.tagName.toLowerCase()}${index2}`;
215
235
  }
216
- const siblings = Array.from(parentNode2.children).filter(
217
- (node2) => node2.tagName === n2.tagName
218
- );
219
- const index$1$1 = siblings.length > 1 ? `[${siblings.indexOf(n2) + 1}]` : "";
220
- const path = getXPath(parentNode2) + "/" + n2.tagName.toLowerCase() + index$1$1;
221
- return path;
236
+ if (node2.nodeType === Node.TEXT_NODE) {
237
+ const parent = node2.parentNode;
238
+ if (!parent) {
239
+ return "";
240
+ }
241
+ const textSiblings = Array.from(parent.childNodes).filter(
242
+ (sibling) => sibling.nodeType === Node.TEXT_NODE
243
+ );
244
+ const index2 = textSiblings.length > 1 ? `[${textSiblings.indexOf(node2) + 1}]` : "";
245
+ return `${getXPath(parent)}/text()${index2}`;
246
+ }
247
+ if (node2.nodeType === Node.CDATA_SECTION_NODE) {
248
+ const parent = node2.parentNode;
249
+ if (!parent) {
250
+ return "";
251
+ }
252
+ const cdataSiblings = Array.from(parent.childNodes).filter(
253
+ (sibling) => sibling.nodeType === Node.CDATA_SECTION_NODE
254
+ );
255
+ const index2 = cdataSiblings.length > 1 ? `[${cdataSiblings.indexOf(node2) + 1}]` : "";
256
+ return `${getXPath(parent)}/text()${index2}`;
257
+ }
258
+ if (node2.nodeType === Node.COMMENT_NODE) {
259
+ const parent = node2.parentNode;
260
+ if (!parent) {
261
+ return "";
262
+ }
263
+ const commentSiblings = Array.from(parent.childNodes).filter(
264
+ (sibling) => sibling.nodeType === Node.COMMENT_NODE
265
+ );
266
+ const index2 = commentSiblings.length > 1 ? `[${commentSiblings.indexOf(node2) + 1}]` : "";
267
+ return `${getXPath(parent)}/comment()${index2}`;
268
+ }
269
+ return "";
222
270
  }
223
271
  function isElement(n2) {
224
272
  return n2.nodeType === n2.ELEMENT_NODE;
@@ -1942,7 +1990,7 @@ function cloneNode$1(obj, parent) {
1942
1990
  }
1943
1991
  return cloned;
1944
1992
  }
1945
- let Node$4$1 = class Node2 {
1993
+ let Node$5$1 = class Node2 {
1946
1994
  constructor(defaults = {}) {
1947
1995
  this.raws = {};
1948
1996
  this[isClean$2$1] = false;
@@ -2234,10 +2282,10 @@ let Node$4$1 = class Node2 {
2234
2282
  return this;
2235
2283
  }
2236
2284
  };
2237
- var node$1 = Node$4$1;
2238
- Node$4$1.default = Node$4$1;
2239
- let Node$3$1 = node$1;
2240
- let Declaration$4$1 = class Declaration extends Node$3$1 {
2285
+ var node$1 = Node$5$1;
2286
+ Node$5$1.default = Node$5$1;
2287
+ let Node$4$1 = node$1;
2288
+ let Declaration$4$1 = class Declaration extends Node$4$1 {
2241
2289
  constructor(defaults) {
2242
2290
  if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
2243
2291
  defaults = __spreadProps(__spreadValues({}, defaults), { value: String(defaults.value) });
@@ -2893,8 +2941,8 @@ let MapGenerator$2$1 = class MapGenerator {
2893
2941
  }
2894
2942
  };
2895
2943
  var mapGenerator$1 = MapGenerator$2$1;
2896
- let Node$2$1 = node$1;
2897
- let Comment$4$1 = class Comment extends Node$2$1 {
2944
+ let Node$3$1 = node$1;
2945
+ let Comment$4$1 = class Comment extends Node$3$1 {
2898
2946
  constructor(defaults) {
2899
2947
  super(defaults);
2900
2948
  this.type = "comment";
@@ -2905,7 +2953,7 @@ Comment$4$1.default = Comment$4$1;
2905
2953
  let { isClean: isClean$1$1, my: my$1$1 } = symbols$1;
2906
2954
  let Declaration$3$1 = declaration$1;
2907
2955
  let Comment$3$1 = comment$1;
2908
- let Node$1$1 = node$1;
2956
+ let Node$2$1 = node$1;
2909
2957
  let parse$4$1;
2910
2958
  let Rule$4$1;
2911
2959
  let AtRule$4$1;
@@ -2925,7 +2973,7 @@ function markDirtyUp$1(node2) {
2925
2973
  }
2926
2974
  }
2927
2975
  }
2928
- let Container$7$1 = class Container extends Node$1$1 {
2976
+ let Container$7$1 = class Container extends Node$2$1 {
2929
2977
  append(...children) {
2930
2978
  for (let child of children) {
2931
2979
  let nodes = this.normalize(child, this.last);
@@ -4953,7 +5001,7 @@ let parse$5 = parse_1$1;
4953
5001
  let list$3 = list_1$1;
4954
5002
  let Rule2$1 = rule$1;
4955
5003
  let Root2$1 = root$1;
4956
- let Node2$1 = node$1;
5004
+ let Node$1$1 = node$1;
4957
5005
  function postcss$3(...plugins) {
4958
5006
  if (plugins.length === 1 && Array.isArray(plugins[0])) {
4959
5007
  plugins = plugins[0];
@@ -5013,7 +5061,7 @@ postcss$3.Result = Result2$1;
5013
5061
  postcss$3.Input = Input2$1;
5014
5062
  postcss$3.Rule = Rule2$1;
5015
5063
  postcss$3.Root = Root2$1;
5016
- postcss$3.Node = Node2$1;
5064
+ postcss$3.Node = Node$1$1;
5017
5065
  LazyResult2$1.registerPostcss(postcss$3);
5018
5066
  var postcss_1$1 = postcss$3;
5019
5067
  postcss$3.default = postcss$3;
@@ -5498,7 +5546,7 @@ function cloneNode(obj, parent) {
5498
5546
  }
5499
5547
  return cloned;
5500
5548
  }
5501
- let Node$4 = class Node3 {
5549
+ let Node$5 = class Node22 {
5502
5550
  constructor(defaults = {}) {
5503
5551
  this.raws = {};
5504
5552
  this[isClean$2] = false;
@@ -5790,10 +5838,10 @@ let Node$4 = class Node3 {
5790
5838
  return this;
5791
5839
  }
5792
5840
  };
5793
- var node = Node$4;
5794
- Node$4.default = Node$4;
5795
- let Node$3 = node;
5796
- let Declaration$4 = class Declaration2 extends Node$3 {
5841
+ var node = Node$5;
5842
+ Node$5.default = Node$5;
5843
+ let Node$4 = node;
5844
+ let Declaration$4 = class Declaration2 extends Node$4 {
5797
5845
  constructor(defaults) {
5798
5846
  if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
5799
5847
  defaults = __spreadProps(__spreadValues({}, defaults), { value: String(defaults.value) });
@@ -6449,8 +6497,8 @@ let MapGenerator$2 = class MapGenerator2 {
6449
6497
  }
6450
6498
  };
6451
6499
  var mapGenerator = MapGenerator$2;
6452
- let Node$2 = node;
6453
- let Comment$4 = class Comment2 extends Node$2 {
6500
+ let Node$3 = node;
6501
+ let Comment$4 = class Comment2 extends Node$3 {
6454
6502
  constructor(defaults) {
6455
6503
  super(defaults);
6456
6504
  this.type = "comment";
@@ -6461,7 +6509,7 @@ Comment$4.default = Comment$4;
6461
6509
  let { isClean: isClean$1, my: my$1 } = symbols;
6462
6510
  let Declaration$3 = declaration;
6463
6511
  let Comment$3 = comment;
6464
- let Node$1 = node;
6512
+ let Node$2 = node;
6465
6513
  let parse$4;
6466
6514
  let Rule$4;
6467
6515
  let AtRule$4;
@@ -6481,7 +6529,7 @@ function markDirtyUp(node2) {
6481
6529
  }
6482
6530
  }
6483
6531
  }
6484
- let Container$7 = class Container2 extends Node$1 {
6532
+ let Container$7 = class Container2 extends Node$2 {
6485
6533
  append(...children) {
6486
6534
  for (let child of children) {
6487
6535
  let nodes = this.normalize(child, this.last);
@@ -8509,7 +8557,7 @@ let parse = parse_1;
8509
8557
  let list = list_1;
8510
8558
  let Rule22 = rule;
8511
8559
  let Root22 = root;
8512
- let Node22 = node;
8560
+ let Node$1 = node;
8513
8561
  function postcss(...plugins) {
8514
8562
  if (plugins.length === 1 && Array.isArray(plugins[0])) {
8515
8563
  plugins = plugins[0];
@@ -8569,7 +8617,7 @@ postcss.Result = Result22;
8569
8617
  postcss.Input = Input22;
8570
8618
  postcss.Rule = Rule22;
8571
8619
  postcss.Root = Root22;
8572
- postcss.Node = Node22;
8620
+ postcss.Node = Node$1;
8573
8621
  LazyResult22.registerPostcss(postcss);
8574
8622
  var postcss_1 = postcss;
8575
8623
  postcss.default = postcss;