@highlight-run/rrweb 1.2.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/dist/plugins/console-record.js +655 -0
  2. package/dist/plugins/console-record.min.js +1 -1
  3. package/dist/plugins/console-record.min.js.map +1 -1
  4. package/dist/plugins/console-replay.js +293 -0
  5. package/dist/plugins/console-replay.min.js +16 -0
  6. package/dist/plugins/console-replay.min.js.map +1 -0
  7. package/dist/plugins/sequential-id-record.js +33 -0
  8. package/dist/plugins/sequential-id-record.min.js +2 -0
  9. package/dist/plugins/sequential-id-record.min.js.map +1 -0
  10. package/dist/plugins/sequential-id-replay.js +37 -0
  11. package/dist/plugins/sequential-id-replay.min.js +2 -0
  12. package/dist/plugins/sequential-id-replay.min.js.map +1 -0
  13. package/dist/record/rrweb-record-pack.js +747 -0
  14. package/dist/record/rrweb-record-pack.min.js +16 -0
  15. package/dist/record/rrweb-record-pack.min.js.map +1 -0
  16. package/dist/record/rrweb-record.js +3318 -0
  17. package/dist/record/rrweb-record.min.js +16 -0
  18. package/dist/record/rrweb-record.min.js.map +1 -0
  19. package/dist/replay/rrweb-replay-unpack.js +4626 -0
  20. package/dist/replay/rrweb-replay-unpack.min.css +2 -0
  21. package/dist/replay/rrweb-replay-unpack.min.css.map +1 -0
  22. package/dist/replay/rrweb-replay-unpack.min.js +30 -0
  23. package/dist/replay/rrweb-replay-unpack.min.js.map +1 -0
  24. package/dist/replay/rrweb-replay.js +4216 -0
  25. package/dist/replay/rrweb-replay.min.css +2 -0
  26. package/dist/replay/rrweb-replay.min.css.map +1 -0
  27. package/dist/replay/rrweb-replay.min.js +30 -0
  28. package/dist/replay/rrweb-replay.min.js.map +1 -0
  29. package/dist/rrweb-all.js +8708 -0
  30. package/dist/rrweb-all.min.css +2 -0
  31. package/dist/rrweb-all.min.css.map +1 -0
  32. package/dist/rrweb-all.min.js +30 -0
  33. package/dist/rrweb-all.min.js.map +1 -0
  34. package/dist/rrweb.js +7294 -0
  35. package/dist/rrweb.min.css +2 -0
  36. package/dist/rrweb.min.css.map +1 -0
  37. package/dist/rrweb.min.js +2 -2
  38. package/dist/rrweb.min.js.map +1 -1
  39. package/es/rrweb/ext/@xstate/fsm/es/index.js +17 -0
  40. package/es/rrweb/ext/base64-arraybuffer/dist/base64-arraybuffer.es5.js +49 -0
  41. package/es/rrweb/ext/fflate/esm/browser.js +777 -0
  42. package/es/rrweb/ext/mitt/dist/mitt.es.js +63 -0
  43. package/es/rrweb/packages/rrweb/ext/tslib/tslib.es6.js +78 -0
  44. package/es/rrweb/packages/rrweb/src/entries/all.js +13 -0
  45. package/es/rrweb/packages/rrweb/src/index.js +12 -0
  46. package/es/rrweb/packages/rrweb/src/packer/base.js +3 -0
  47. package/es/rrweb/packages/rrweb/src/packer/pack.js +10 -0
  48. package/es/rrweb/packages/rrweb/src/packer/unpack.js +29 -0
  49. package/es/rrweb/packages/rrweb/src/plugins/console/record/error-stack-parser.js +179 -0
  50. package/es/rrweb/packages/rrweb/src/plugins/console/record/index.js +134 -0
  51. package/es/rrweb/packages/rrweb/src/plugins/console/record/stringify.js +141 -0
  52. package/es/rrweb/packages/rrweb/src/plugins/console/replay/index.js +111 -0
  53. package/es/rrweb/packages/rrweb/src/plugins/sequential-id/record/index.js +23 -0
  54. package/es/rrweb/packages/rrweb/src/plugins/sequential-id/replay/index.js +28 -0
  55. package/es/rrweb/packages/rrweb/src/record/iframe-manager.js +32 -0
  56. package/es/rrweb/packages/rrweb/src/record/index.js +381 -0
  57. package/es/rrweb/packages/rrweb/src/record/mutation.js +532 -0
  58. package/es/rrweb/packages/rrweb/src/record/observer.js +665 -0
  59. package/es/rrweb/packages/rrweb/src/record/observers/canvas/2d.js +78 -0
  60. package/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js +93 -0
  61. package/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas.js +30 -0
  62. package/es/rrweb/packages/rrweb/src/record/observers/canvas/serialize-args.js +116 -0
  63. package/es/rrweb/packages/rrweb/src/record/observers/canvas/webgl.js +78 -0
  64. package/es/rrweb/packages/rrweb/src/record/shadow-dom-manager.js +45 -0
  65. package/es/rrweb/packages/rrweb/src/replay/canvas/2d.js +25 -0
  66. package/es/rrweb/packages/rrweb/src/replay/canvas/index.js +35 -0
  67. package/es/rrweb/packages/rrweb/src/replay/canvas/webgl.js +124 -0
  68. package/es/rrweb/packages/rrweb/src/replay/index.js +1864 -0
  69. package/es/rrweb/packages/rrweb/src/replay/machine.js +321 -0
  70. package/es/rrweb/packages/rrweb/src/replay/smoothscroll.js +221 -0
  71. package/es/rrweb/packages/rrweb/src/replay/styles/inject-style.js +8 -0
  72. package/es/rrweb/packages/rrweb/src/replay/timer.js +96 -0
  73. package/es/rrweb/packages/rrweb/src/replay/virtual-styles.js +121 -0
  74. package/es/rrweb/packages/rrweb/src/types.js +75 -0
  75. package/es/rrweb/packages/rrweb/src/utils.js +509 -0
  76. package/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js +1697 -0
  77. package/lib/plugins/console-record.js +650 -0
  78. package/lib/plugins/console-replay.js +288 -0
  79. package/lib/plugins/sequential-id-record.js +28 -0
  80. package/lib/plugins/sequential-id-replay.js +32 -0
  81. package/lib/record/rrweb-record-pack.js +742 -0
  82. package/lib/record/rrweb-record.js +3315 -0
  83. package/lib/replay/rrweb-replay-unpack.js +4621 -0
  84. package/lib/replay/rrweb-replay.js +4211 -0
  85. package/lib/rrweb-all.js +8703 -0
  86. package/lib/rrweb.js +7289 -0
  87. package/package.json +41 -43
  88. package/typings/entries/all.d.ts +6 -0
  89. package/{dist → typings}/entries/record-pack.d.ts +0 -0
  90. package/{dist → typings}/entries/replay-unpack.d.ts +0 -0
  91. package/{dist → typings}/index.d.ts +1 -2
  92. package/{dist → typings}/packer/base.d.ts +0 -0
  93. package/{dist → typings}/packer/index.d.ts +0 -0
  94. package/{dist → typings}/packer/pack.d.ts +0 -0
  95. package/{dist → typings}/packer/unpack.d.ts +0 -0
  96. package/{dist → typings}/plugins/console/record/error-stack-parser.d.ts +0 -0
  97. package/{dist → typings}/plugins/console/record/index.d.ts +3 -2
  98. package/{dist → typings}/plugins/console/record/stringify.d.ts +0 -0
  99. package/{dist → typings}/plugins/console/replay/index.d.ts +2 -2
  100. package/{dist → typings}/plugins/sequential-id/record/index.d.ts +0 -0
  101. package/{dist → typings}/plugins/sequential-id/replay/index.d.ts +0 -0
  102. package/{dist → typings}/record/iframe-manager.d.ts +1 -1
  103. package/{dist → typings}/record/index.d.ts +0 -0
  104. package/{dist → typings}/record/mutation.d.ts +5 -8
  105. package/typings/record/observer.d.ts +7 -0
  106. package/{dist → typings}/record/observers/canvas/2d.d.ts +0 -0
  107. package/{dist → typings}/record/observers/canvas/canvas-manager.d.ts +0 -0
  108. package/{dist → typings}/record/observers/canvas/canvas.d.ts +0 -0
  109. package/{dist → typings}/record/observers/canvas/serialize-args.d.ts +1 -1
  110. package/{dist → typings}/record/observers/canvas/webgl.d.ts +0 -0
  111. package/typings/record/observers/canvas/webgl2.d.ts +2 -0
  112. package/typings/record/shadow-dom-manager.d.ts +21 -0
  113. package/{dist → typings}/replay/canvas/2d.d.ts +0 -0
  114. package/{dist → typings}/replay/canvas/index.d.ts +0 -0
  115. package/{dist → typings}/replay/canvas/webgl.d.ts +0 -0
  116. package/{dist → typings}/replay/index.d.ts +1 -0
  117. package/{dist → typings}/replay/machine.d.ts +0 -0
  118. package/{dist → typings}/replay/smoothscroll.d.ts +0 -0
  119. package/{dist → typings}/replay/styles/inject-style.d.ts +0 -0
  120. package/{dist → typings}/replay/timer.d.ts +0 -0
  121. package/{dist → typings}/replay/virtual-styles.d.ts +1 -1
  122. package/{dist → typings}/rrdom/index.d.ts +0 -0
  123. package/{dist → typings}/rrdom/tree-node.d.ts +0 -0
  124. package/{dist → typings}/types.d.ts +7 -8
  125. package/{dist → typings}/utils.d.ts +3 -4
  126. package/CHANGELOG.md +0 -26
  127. package/README.md +0 -124
  128. package/README.zh_CN.md +0 -122
  129. package/dist/entries/all.d.ts +0 -4
  130. package/dist/index.css +0 -82
  131. package/dist/index.css.map +0 -1
  132. package/dist/index.js +0 -3
  133. package/dist/index.js.LICENSE.txt +0 -14
  134. package/dist/index.js.map +0 -1
  135. package/dist/plugins/entries/all.d.ts +0 -4
  136. package/dist/plugins/entries/record-pack.d.ts +0 -2
  137. package/dist/plugins/entries/replay-unpack.d.ts +0 -2
  138. package/dist/plugins/index.d.ts +0 -9
  139. package/dist/plugins/packer/base.d.ts +0 -7
  140. package/dist/plugins/packer/index.d.ts +0 -2
  141. package/dist/plugins/packer/pack.d.ts +0 -2
  142. package/dist/plugins/packer/unpack.d.ts +0 -2
  143. package/dist/plugins/plugins/console/record/error-stack-parser.d.ts +0 -37
  144. package/dist/plugins/plugins/console/record/index.d.ts +0 -41
  145. package/dist/plugins/plugins/console/record/stringify.d.ts +0 -2
  146. package/dist/plugins/plugins/console/replay/index.d.ts +0 -9
  147. package/dist/plugins/plugins/sequential-id/record/index.d.ts +0 -6
  148. package/dist/plugins/plugins/sequential-id/replay/index.d.ts +0 -7
  149. package/dist/plugins/record/iframe-manager.d.ts +0 -13
  150. package/dist/plugins/record/index.d.ts +0 -9
  151. package/dist/plugins/record/mutation.d.ts +0 -45
  152. package/dist/plugins/record/observer.d.ts +0 -11
  153. package/dist/plugins/record/observers/canvas/2d.d.ts +0 -2
  154. package/dist/plugins/record/observers/canvas/canvas-manager.d.ts +0 -32
  155. package/dist/plugins/record/observers/canvas/canvas.d.ts +0 -2
  156. package/dist/plugins/record/observers/canvas/serialize-args.d.ts +0 -6
  157. package/dist/plugins/record/observers/canvas/webgl.d.ts +0 -2
  158. package/dist/plugins/record/shadow-dom-manager.d.ts +0 -34
  159. package/dist/plugins/replay/canvas/2d.d.ts +0 -9
  160. package/dist/plugins/replay/canvas/index.d.ts +0 -9
  161. package/dist/plugins/replay/canvas/webgl.d.ts +0 -11
  162. package/dist/plugins/replay/index.d.ts +0 -82
  163. package/dist/plugins/replay/machine.d.ts +0 -85
  164. package/dist/plugins/replay/smoothscroll.d.ts +0 -1
  165. package/dist/plugins/replay/styles/inject-style.d.ts +0 -2
  166. package/dist/plugins/replay/timer.d.ts +0 -19
  167. package/dist/plugins/replay/virtual-styles.d.ts +0 -43
  168. package/dist/plugins/rrdom/index.d.ts +0 -1
  169. package/dist/plugins/rrdom/tree-node.d.ts +0 -20
  170. package/dist/plugins/snapshot/css.d.ts +0 -92
  171. package/dist/plugins/snapshot/index.d.ts +0 -5
  172. package/dist/plugins/snapshot/rebuild.d.ts +0 -19
  173. package/dist/plugins/snapshot/snapshot.d.ts +0 -49
  174. package/dist/plugins/snapshot/types.d.ts +0 -99
  175. package/dist/plugins/snapshot/utils.d.ts +0 -11
  176. package/dist/plugins/types.d.ts +0 -509
  177. package/dist/plugins/utils.d.ts +0 -71
  178. package/dist/record/observer.d.ts +0 -11
  179. package/dist/record/shadow-dom-manager.d.ts +0 -34
  180. package/dist/snapshot/css.d.ts +0 -92
  181. package/dist/snapshot/index.d.ts +0 -5
  182. package/dist/snapshot/rebuild.d.ts +0 -19
  183. package/dist/snapshot/snapshot.d.ts +0 -49
  184. package/dist/snapshot/types.d.ts +0 -99
  185. package/dist/snapshot/utils.d.ts +0 -11
@@ -1 +1 @@
1
- {"version":3,"file":"console-record.min.js","sources":["../../node_modules/tslib/tslib.es6.js","../../src/plugins/console/record/stringify.ts","../../src/plugins/console/record/error-stack-parser.ts","../../src/types.ts","../../src/snapshot/types.ts","../../src/utils.ts","../../src/plugins/console/record/index.ts"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","// tslint:disable:no-any no-bitwise forin\n/**\n * this file is used to serialize log message to string\n *\n */\n\nimport { StringifyOptions } from './index';\n\n/**\n * transfer the node path in Event to string\n * @param node the first node in a node path array\n */\nfunction pathToSelector(node: HTMLElement): string | '' {\n if (!node || !node.outerHTML) {\n return '';\n }\n\n let path = '';\n while (node.parentElement) {\n let name = node.localName;\n if (!name) {\n break;\n }\n name = name.toLowerCase();\n let parent = node.parentElement;\n\n let domSiblings = [];\n\n if (parent.children && parent.children.length > 0) {\n // tslint:disable-next-line:prefer-for-of\n for (let i = 0; i < parent.children.length; i++) {\n let sibling = parent.children[i];\n if (sibling.localName && sibling.localName.toLowerCase) {\n if (sibling.localName.toLowerCase() === name) {\n domSiblings.push(sibling);\n }\n }\n }\n }\n\n if (domSiblings.length > 1) {\n name += ':eq(' + domSiblings.indexOf(node) + ')';\n }\n path = name + (path ? '>' + path : '');\n node = parent;\n }\n\n return path;\n}\n\n/**\n * stringify any js object\n * @param obj the object to stringify\n */\nexport function stringify(\n obj: any,\n stringifyOptions?: StringifyOptions,\n): string {\n const options: StringifyOptions = {\n numOfKeysLimit: 50,\n };\n Object.assign(options, stringifyOptions);\n const stack: any[] = [];\n const keys: any[] = [];\n return JSON.stringify(obj, function (key, value) {\n /**\n * forked from https://github.com/moll/json-stringify-safe/blob/master/stringify.js\n * to deCycle the object\n */\n if (stack.length > 0) {\n const thisPos = stack.indexOf(this);\n ~thisPos ? stack.splice(thisPos + 1) : stack.push(this);\n ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);\n if (~stack.indexOf(value)) {\n if (stack[0] === value) {\n value = '[Circular ~]';\n } else {\n value =\n '[Circular ~.' +\n keys.slice(0, stack.indexOf(value)).join('.') +\n ']';\n }\n }\n } else {\n stack.push(value);\n }\n /* END of the FORK */\n\n if (value === null || value === undefined) {\n return value;\n }\n if (shouldToString(value)) {\n return toString(value);\n }\n if (value instanceof Event) {\n const eventResult: any = {};\n for (const eventKey in value) {\n const eventValue = (value as any)[eventKey];\n if (Array.isArray(eventValue)) {\n eventResult[eventKey] = pathToSelector(\n eventValue.length ? eventValue[0] : null,\n );\n } else {\n eventResult[eventKey] = eventValue;\n }\n }\n return eventResult;\n } else if (value instanceof Node) {\n if (value instanceof HTMLElement) {\n return value ? value.outerHTML : '';\n }\n return value.nodeName;\n }\n return value;\n });\n\n /**\n * whether we should call toString function of this object\n */\n function shouldToString(_obj: object): boolean {\n if (\n typeof _obj === 'object' &&\n Object.keys(_obj).length > options.numOfKeysLimit\n ) {\n return true;\n }\n if (typeof _obj === 'function') {\n return true;\n }\n return false;\n }\n\n /**\n * limit the toString() result according to option\n */\n function toString(_obj: object): string {\n let str = _obj.toString();\n if (options.stringLengthLimit && str.length > options.stringLengthLimit) {\n str = `${str.slice(0, options.stringLengthLimit)}...`;\n }\n return str;\n }\n}\n","// tslint:disable\n/**\n * Class StackFrame is a fork of https://github.com/stacktracejs/stackframe/blob/master/stackframe.js\n * I fork it because:\n * 1. There are some build issues when importing this package.\n * 2. Rewrites into typescript give us a better type interface.\n * 3. StackFrame contains some functions we don't need.\n */\nexport class StackFrame {\n private fileName: string;\n private functionName: string;\n private lineNumber?: number;\n private columnNumber?: number;\n\n constructor(obj: {\n fileName?: string;\n functionName?: string;\n lineNumber?: number;\n columnNumber?: number;\n }) {\n this.fileName = obj.fileName || '';\n this.functionName = obj.functionName || '';\n this.lineNumber = obj.lineNumber;\n this.columnNumber = obj.columnNumber;\n }\n\n toString() {\n const lineNumber = this.lineNumber || '';\n const columnNumber = this.columnNumber || '';\n if (this.functionName) {\n return (\n this.functionName +\n ' (' +\n this.fileName +\n ':' +\n lineNumber +\n ':' +\n columnNumber +\n ')'\n );\n }\n return this.fileName + ':' + lineNumber + ':' + columnNumber;\n }\n}\n\n/**\n * ErrorStackParser is a fork of https://github.com/stacktracejs/error-stack-parser/blob/master/error-stack-parser.js\n * I fork it because:\n * 1. There are some build issues when importing this package.\n * 2. Rewrites into typescript give us a better type interface.\n */\nconst FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\\S+:\\d+/;\nconst CHROME_IE_STACK_REGEXP = /^\\s*at .*(\\S+:\\d+|\\(native\\))/m;\nconst SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\\[native code])?$/;\nexport const ErrorStackParser = {\n /**\n * Given an Error object, extract the most information from it.\n *\n * @param {Error} error object\n * @return {Array} of StackFrames\n */\n parse: function (error: Error): StackFrame[] {\n if (\n // @ts-ignore\n typeof error.stacktrace !== 'undefined' ||\n // @ts-ignore\n typeof error['opera#sourceloc'] !== 'undefined'\n ) {\n return this.parseOpera(\n error as {\n stacktrace?: string;\n message: string;\n stack?: string;\n },\n );\n } else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {\n return this.parseV8OrIE(error as { stack: string });\n } else if (error.stack) {\n return this.parseFFOrSafari(error as { stack: string });\n } else {\n throw new Error('Cannot parse given Error object');\n }\n },\n // Separate line and column numbers from a string of the form: (URI:Line:Column)\n extractLocation: function (urlLike: string) {\n // Fail-fast but return locations like \"(native)\"\n if (urlLike.indexOf(':') === -1) {\n return [urlLike];\n }\n\n const regExp = /(.+?)(?::(\\d+))?(?::(\\d+))?$/;\n const parts = regExp.exec(urlLike.replace(/[()]/g, ''));\n if (!parts) throw new Error(`Cannot parse given url: ${urlLike}`);\n return [parts[1], parts[2] || undefined, parts[3] || undefined];\n },\n parseV8OrIE: function (error: { stack: string }) {\n const filtered = error.stack.split('\\n').filter(function (line) {\n return !!line.match(CHROME_IE_STACK_REGEXP);\n }, this);\n\n return filtered.map(function (line) {\n if (line.indexOf('(eval ') > -1) {\n // Throw away eval information until we implement stacktrace.js/stackframe#8\n line = line\n .replace(/eval code/g, 'eval')\n .replace(/(\\(eval at [^()]*)|(\\),.*$)/g, '');\n }\n let sanitizedLine = line.replace(/^\\s+/, '').replace(/\\(eval code/g, '(');\n\n // capture and preseve the parenthesized location \"(/foo/my bar.js:12:87)\" in\n // case it has spaces in it, as the string is split on \\s+ later on\n const location = sanitizedLine.match(/ (\\((.+):(\\d+):(\\d+)\\)$)/);\n\n // remove the parenthesized location from the line, if it was matched\n sanitizedLine = location\n ? sanitizedLine.replace(location[0], '')\n : sanitizedLine;\n\n const tokens = sanitizedLine.split(/\\s+/).slice(1);\n // if a location was matched, pass it to extractLocation() otherwise pop the last token\n const locationParts = this.extractLocation(\n location ? location[1] : tokens.pop(),\n );\n const functionName = tokens.join(' ') || undefined;\n const fileName =\n ['eval', '<anonymous>'].indexOf(locationParts[0]) > -1\n ? undefined\n : locationParts[0];\n\n return new StackFrame({\n functionName,\n fileName,\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n });\n }, this);\n },\n parseFFOrSafari: function (error: { stack: string }) {\n const filtered = error.stack.split('\\n').filter(function (line) {\n return !line.match(SAFARI_NATIVE_CODE_REGEXP);\n }, this);\n\n return filtered.map(function (line) {\n // Throw away eval information until we implement stacktrace.js/stackframe#8\n if (line.indexOf(' > eval') > -1) {\n line = line.replace(\n / line (\\d+)(?: > eval line \\d+)* > eval:\\d+:\\d+/g,\n ':$1',\n );\n }\n\n if (line.indexOf('@') === -1 && line.indexOf(':') === -1) {\n // Safari eval frames only have function names and nothing else\n return new StackFrame({\n functionName: line,\n });\n } else {\n const functionNameRegex = /((.*\".+\"[^@]*)?[^@]*)(?:@)/;\n const matches = line.match(functionNameRegex);\n const functionName = matches && matches[1] ? matches[1] : undefined;\n const locationParts = this.extractLocation(\n line.replace(functionNameRegex, ''),\n );\n\n return new StackFrame({\n functionName,\n fileName: locationParts[0],\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n });\n }\n }, this);\n },\n parseOpera: function (e: {\n stacktrace?: string;\n message: string;\n stack?: string;\n }): StackFrame[] {\n if (\n !e.stacktrace ||\n (e.message.indexOf('\\n') > -1 &&\n e.message.split('\\n').length > e.stacktrace.split('\\n').length)\n ) {\n return this.parseOpera9(e as { message: string });\n } else if (!e.stack) {\n return this.parseOpera10(e as { stacktrace: string });\n } else {\n return this.parseOpera11(e as { stack: string });\n }\n },\n parseOpera9: function (e: { message: string }) {\n const lineRE = /Line (\\d+).*script (?:in )?(\\S+)/i;\n const lines = e.message.split('\\n');\n const result = [];\n\n for (let i = 2, len = lines.length; i < len; i += 2) {\n const match = lineRE.exec(lines[i]);\n if (match) {\n result.push(\n new StackFrame({\n fileName: match[2],\n lineNumber: parseFloat(match[1]),\n }),\n );\n }\n }\n\n return result;\n },\n parseOpera10: function (e: { stacktrace: string }) {\n const lineRE = /Line (\\d+).*script (?:in )?(\\S+)(?:: In function (\\S+))?$/i;\n const lines = e.stacktrace.split('\\n');\n const result = [];\n\n for (let i = 0, len = lines.length; i < len; i += 2) {\n const match = lineRE.exec(lines[i]);\n if (match) {\n result.push(\n new StackFrame({\n functionName: match[3] || undefined,\n fileName: match[2],\n lineNumber: parseFloat(match[1]),\n }),\n );\n }\n }\n\n return result;\n },\n // Opera 10.65+ Error.stack very similar to FF/Safari\n parseOpera11: function (error: { stack: string }) {\n const filtered = error.stack.split('\\n').filter(function (line) {\n return (\n !!line.match(FIREFOX_SAFARI_STACK_REGEXP) &&\n !line.match(/^Error created at/)\n );\n }, this);\n\n return filtered.map(function (line: string) {\n const tokens = line.split('@');\n const locationParts = this.extractLocation(tokens.pop());\n const functionCall = tokens.shift() || '';\n const functionName =\n functionCall\n .replace(/<anonymous function(: (\\w+))?>/, '$2')\n .replace(/\\([^)]*\\)/g, '') || undefined;\n return new StackFrame({\n functionName,\n fileName: locationParts[0],\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n });\n }, this);\n },\n};\n","import {\n serializedNodeWithId,\n idNodeMap,\n INode,\n MaskInputOptions,\n SlimDOMOptions,\n MaskInputFn,\n MaskTextFn,\n} from './snapshot';\nimport { PackFn, UnpackFn } from './packer/base';\nimport { FontFaceDescriptors } from 'css-font-loading-module';\nimport { IframeManager } from './record/iframe-manager';\nimport { ShadowDomManager } from './record/shadow-dom-manager';\nimport type { Replayer } from './replay';\nimport { CanvasManager } from './record/observers/canvas/canvas-manager';\n\nexport enum EventType {\n DomContentLoaded,\n Load,\n FullSnapshot,\n IncrementalSnapshot,\n Meta,\n Custom,\n Plugin,\n}\n\nexport type SessionInterval = {\n startTime: number;\n endTime: number;\n duration: number;\n active: boolean;\n};\n\nexport type domContentLoadedEvent = {\n type: EventType.DomContentLoaded;\n data: {};\n};\n\nexport type loadedEvent = {\n type: EventType.Load;\n data: {};\n};\n\nexport type fullSnapshotEvent = {\n type: EventType.FullSnapshot;\n data: {\n node: serializedNodeWithId;\n initialOffset: {\n top: number;\n left: number;\n };\n };\n};\n\nexport type incrementalSnapshotEvent = {\n type: EventType.IncrementalSnapshot;\n data: incrementalData;\n};\n\nexport type metaEvent = {\n type: EventType.Meta;\n data: {\n href: string;\n width: number;\n height: number;\n };\n};\n\nexport type customEvent<T = unknown> = {\n type: EventType.Custom;\n data: {\n tag: string;\n payload: T;\n };\n};\n\nexport type pluginEvent<T = unknown> = {\n type: EventType.Plugin;\n data: {\n plugin: string;\n payload: T;\n };\n};\n\nexport type styleSheetEvent = {};\n\nexport enum IncrementalSource {\n Mutation,\n MouseMove,\n MouseInteraction,\n Scroll,\n ViewportResize,\n Input,\n TouchMove,\n MediaInteraction,\n StyleSheetRule,\n CanvasMutation,\n Font,\n Log,\n Drag,\n StyleDeclaration,\n}\n\nexport type mutationData = {\n source: IncrementalSource.Mutation;\n} & mutationCallbackParam;\n\nexport type mousemoveData = {\n source:\n | IncrementalSource.MouseMove\n | IncrementalSource.TouchMove\n | IncrementalSource.Drag;\n positions: mousePosition[];\n};\n\nexport type mouseInteractionData = {\n source: IncrementalSource.MouseInteraction;\n} & mouseInteractionParam;\n\nexport type scrollData = {\n source: IncrementalSource.Scroll;\n} & scrollPosition;\n\nexport type viewportResizeData = {\n source: IncrementalSource.ViewportResize;\n} & viewportResizeDimension;\n\nexport type inputData = {\n source: IncrementalSource.Input;\n id: number;\n} & inputValue;\n\nexport type mediaInteractionData = {\n source: IncrementalSource.MediaInteraction;\n} & mediaInteractionParam;\n\nexport type styleSheetRuleData = {\n source: IncrementalSource.StyleSheetRule;\n} & styleSheetRuleParam;\n\nexport type styleDeclarationData = {\n source: IncrementalSource.StyleDeclaration;\n} & styleDeclarationParam;\n\nexport type canvasMutationData = {\n source: IncrementalSource.CanvasMutation;\n} & canvasMutationParam;\n\nexport type fontData = {\n source: IncrementalSource.Font;\n} & fontParam;\n\nexport type incrementalData =\n | mutationData\n | mousemoveData\n | mouseInteractionData\n | scrollData\n | viewportResizeData\n | inputData\n | mediaInteractionData\n | styleSheetRuleData\n | canvasMutationData\n | fontData\n | styleDeclarationData;\n\nexport type event =\n | domContentLoadedEvent\n | loadedEvent\n | fullSnapshotEvent\n | incrementalSnapshotEvent\n | metaEvent\n | customEvent\n | pluginEvent;\n\nexport type eventWithTime = event & {\n timestamp: number;\n delay?: number;\n};\n\nexport type blockClass = string | RegExp;\n\nexport type maskTextClass = string | RegExp;\n\nexport type SamplingStrategy = Partial<{\n /**\n * false means not to record mouse/touch move events\n * number is the throttle threshold of recording mouse/touch move\n */\n mousemove: boolean | number;\n /**\n * number is the throttle threshold of mouse/touch move callback\n */\n mousemoveCallback: number;\n /**\n * false means not to record mouse interaction events\n * can also specify record some kinds of mouse interactions\n */\n mouseInteraction: boolean | Record<string, boolean | undefined>;\n /**\n * number is the throttle threshold of recording scroll\n */\n scroll: number;\n /**\n * number is the throttle threshold of recording media interactions\n */\n media: number;\n /**\n * 'all' will record all the input events\n * 'last' will only record the last input value while input a sequence of chars\n */\n input: 'all' | 'last';\n}>;\n\nexport type RecordPlugin<TOptions = unknown> = {\n name: string;\n observer?: (cb: Function, win: IWindow, options: TOptions) => listenerHandler;\n eventProcessor?: <TExtend>(event: eventWithTime) => eventWithTime & TExtend;\n options: TOptions;\n};\n\nexport type recordOptions<T> = {\n emit?: (e: T, isCheckout?: boolean) => void;\n checkoutEveryNth?: number;\n checkoutEveryNms?: number;\n blockClass?: blockClass;\n blockSelector?: string;\n ignoreClass?: string;\n maskTextClass?: maskTextClass;\n maskTextSelector?: string;\n maskAllInputs?: boolean;\n maskInputOptions?: MaskInputOptions;\n maskInputFn?: MaskInputFn;\n maskTextFn?: MaskTextFn;\n slimDOMOptions?: SlimDOMOptions | 'all' | true;\n inlineStylesheet?: boolean;\n hooks?: hooksParam;\n packFn?: PackFn;\n sampling?: SamplingStrategy;\n recordCanvas?: boolean;\n userTriggeredOnInput?: boolean;\n collectFonts?: boolean;\n plugins?: RecordPlugin[];\n // departed, please use sampling options\n mousemoveWait?: number;\n keepIframeSrcFn?: KeepIframeSrcFn;\n enableStrictPrivacy?: boolean;\n};\n\nexport type observerParam = {\n mutationCb: mutationCallBack;\n mousemoveCb: mousemoveCallBack;\n mouseInteractionCb: mouseInteractionCallBack;\n scrollCb: scrollCallback;\n viewportResizeCb: viewportResizeCallback;\n inputCb: inputCallback;\n mediaInteractionCb: mediaInteractionCallback;\n blockClass: blockClass;\n blockSelector: string | null;\n ignoreClass: string;\n maskTextClass: maskTextClass;\n maskTextSelector: string | null;\n maskInputOptions: MaskInputOptions;\n maskInputFn?: MaskInputFn;\n maskTextFn?: MaskTextFn;\n inlineStylesheet: boolean;\n styleSheetRuleCb: styleSheetRuleCallback;\n styleDeclarationCb: styleDeclarationCallback;\n canvasMutationCb: canvasMutationCallback;\n fontCb: fontCallback;\n sampling: SamplingStrategy;\n recordCanvas: boolean;\n userTriggeredOnInput: boolean;\n collectFonts: boolean;\n slimDOMOptions: SlimDOMOptions;\n doc: Document;\n mirror: Mirror;\n iframeManager: IframeManager;\n shadowDomManager: ShadowDomManager;\n canvasManager: CanvasManager;\n plugins: Array<{\n observer: Function;\n callback: Function;\n options: unknown;\n }>;\n enableStrictPrivacy: boolean;\n};\n\nexport type hooksParam = {\n mutation?: mutationCallBack;\n mousemove?: mousemoveCallBack;\n mouseInteraction?: mouseInteractionCallBack;\n scroll?: scrollCallback;\n viewportResize?: viewportResizeCallback;\n input?: inputCallback;\n mediaInteaction?: mediaInteractionCallback;\n styleSheetRule?: styleSheetRuleCallback;\n styleDeclaration?: styleDeclarationCallback;\n canvasMutation?: canvasMutationCallback;\n font?: fontCallback;\n};\n\n// https://dom.spec.whatwg.org/#interface-mutationrecord\nexport type mutationRecord = {\n type: string;\n target: Node;\n oldValue: string | null;\n addedNodes: NodeList;\n removedNodes: NodeList;\n attributeName: string | null;\n};\n\nexport type textCursor = {\n node: Node;\n value: string | null;\n};\nexport type textMutation = {\n id: number;\n value: string | null;\n};\n\nexport type styleAttributeValue = {\n [key: string]: styleValueWithPriority | string | false;\n};\n\nexport type styleValueWithPriority = [string, string];\n\nexport type attributeCursor = {\n node: Node;\n attributes: {\n [key: string]: string | styleAttributeValue | null;\n };\n};\nexport type attributeMutation = {\n id: number;\n attributes: {\n [key: string]: string | styleAttributeValue | null;\n };\n};\n\nexport type removedNodeMutation = {\n parentId: number;\n id: number;\n isShadow?: boolean;\n};\n\nexport type addedNodeMutation = {\n parentId: number;\n // Newly recorded mutations will not have previousId any more, just for compatibility\n previousId?: number | null;\n nextId: number | null;\n node: serializedNodeWithId;\n};\n\nexport type mutationCallbackParam = {\n texts: textMutation[];\n attributes: attributeMutation[];\n removes: removedNodeMutation[];\n adds: addedNodeMutation[];\n isAttachIframe?: true;\n};\n\nexport type mutationCallBack = (m: mutationCallbackParam) => void;\n\nexport type mousemoveCallBack = (\n p: mousePosition[],\n source:\n | IncrementalSource.MouseMove\n | IncrementalSource.TouchMove\n | IncrementalSource.Drag,\n) => void;\n\nexport type mousePosition = {\n x: number;\n y: number;\n id: number;\n timeOffset: number;\n};\n\nexport type mouseMovePos = {\n x: number;\n y: number;\n id: number;\n debugData: incrementalData;\n};\n\nexport enum MouseInteractions {\n MouseUp,\n MouseDown,\n Click,\n ContextMenu,\n DblClick,\n Focus,\n Blur,\n TouchStart,\n TouchMove_Departed, // we will start a separate observer for touch move event\n TouchEnd,\n TouchCancel,\n}\n\nexport enum CanvasContext {\n '2D',\n WebGL,\n WebGL2,\n}\n\nexport type SerializedWebGlArg =\n | {\n rr_type: 'ArrayBuffer';\n base64: string; // base64\n }\n | {\n rr_type: string;\n src: string; // url of image\n }\n | {\n rr_type: string;\n args: Array<SerializedWebGlArg>;\n }\n | {\n rr_type: string;\n index: number;\n }\n | string\n | number\n | boolean\n | null\n | SerializedWebGlArg[];\n\ntype mouseInteractionParam = {\n type: MouseInteractions;\n id: number;\n x: number;\n y: number;\n};\n\nexport type mouseInteractionCallBack = (d: mouseInteractionParam) => void;\n\nexport type scrollPosition = {\n id: number;\n x: number;\n y: number;\n};\n\nexport type scrollCallback = (p: scrollPosition) => void;\n\nexport type styleSheetAddRule = {\n rule: string;\n index?: number | number[];\n};\n\nexport type styleSheetDeleteRule = {\n index: number | number[];\n};\n\nexport type styleSheetRuleParam = {\n id: number;\n removes?: styleSheetDeleteRule[];\n adds?: styleSheetAddRule[];\n};\n\nexport type styleSheetRuleCallback = (s: styleSheetRuleParam) => void;\n\nexport type styleDeclarationParam = {\n id: number;\n index: number[];\n set?: {\n property: string;\n value: string | null;\n priority: string | undefined;\n };\n remove?: {\n property: string;\n };\n};\n\nexport type styleDeclarationCallback = (s: styleDeclarationParam) => void;\n\nexport type canvasMutationCommand = {\n property: string;\n args: Array<unknown>;\n setter?: true;\n};\n\nexport type canvasMutationParam =\n | {\n id: number;\n type: CanvasContext;\n commands: canvasMutationCommand[];\n }\n | ({\n id: number;\n type: CanvasContext;\n } & canvasMutationCommand);\n\nexport type canvasMutationWithType = {\n type: CanvasContext;\n} & canvasMutationCommand;\n\nexport type canvasMutationCallback = (p: canvasMutationParam) => void;\n\nexport type canvasManagerMutationCallback = (\n target: HTMLCanvasElement,\n p: canvasMutationWithType,\n) => void;\n\nexport type fontParam = {\n family: string;\n fontSource: string;\n buffer: boolean;\n descriptors?: FontFaceDescriptors;\n};\n\nexport type fontCallback = (p: fontParam) => void;\n\nexport type viewportResizeDimension = {\n width: number;\n height: number;\n};\n\nexport type viewportResizeCallback = (d: viewportResizeDimension) => void;\n\nexport type inputValue = {\n text: string;\n isChecked: boolean;\n\n // `userTriggered` indicates if this event was triggered directly by user (userTriggered: true)\n // or was triggered indirectly (userTriggered: false)\n // Example of `userTriggered` in action:\n // User clicks on radio element (userTriggered: true) which triggers the other radio element to change (userTriggered: false)\n userTriggered?: boolean;\n};\n\nexport type inputCallback = (v: inputValue & { id: number }) => void;\n\nexport const enum MediaInteractions {\n Play,\n Pause,\n Seeked,\n VolumeChange,\n}\n\nexport type mediaInteractionParam = {\n type: MediaInteractions;\n id: number;\n currentTime?: number;\n volume?: number;\n muted?: boolean;\n};\n\nexport type mediaInteractionCallback = (p: mediaInteractionParam) => void;\n\nexport type DocumentDimension = {\n x: number;\n y: number;\n // scale value relative to its parent iframe\n relativeScale: number;\n // scale value relative to the root iframe\n absoluteScale: number;\n};\n\nexport type Mirror = {\n map: idNodeMap;\n getId: (n: INode) => number;\n getNode: (id: number) => INode | null;\n removeNodeFromMap: (n: INode) => void;\n has: (id: number) => boolean;\n reset: () => void;\n};\n\nexport type throttleOptions = {\n leading?: boolean;\n trailing?: boolean;\n};\n\nexport type listenerHandler = () => void;\nexport type hookResetter = () => void;\n\nexport type ReplayPlugin = {\n handler: (\n event: eventWithTime,\n isSync: boolean,\n context: { replayer: Replayer },\n ) => void;\n};\nexport type playerConfig = {\n speed: number;\n maxSpeed: number;\n root: Element;\n loadTimeout: number;\n skipInactive: boolean;\n showWarning: boolean;\n showDebug: boolean;\n blockClass: string;\n liveMode: boolean;\n insertStyleRules: string[];\n triggerFocus: boolean;\n UNSAFE_replayCanvas: boolean;\n pauseAnimation?: boolean;\n mouseTail:\n | boolean\n | {\n duration?: number;\n lineCap?: string;\n lineWidth?: number;\n strokeStyle?: string;\n };\n unpackFn?: UnpackFn;\n plugins?: ReplayPlugin[];\n inactiveThreshold: number;\n inactiveSkipTime: number;\n};\n\nexport type playerMetaData = {\n startTime: number;\n endTime: number;\n totalTime: number;\n};\n\nexport type missingNode = {\n node: Node;\n mutation: addedNodeMutation;\n};\nexport type missingNodeMap = {\n [id: number]: missingNode;\n};\n\nexport type actionWithDelay = {\n doAction: () => void;\n delay: number;\n};\n\nexport type Handler = (event?: unknown) => void;\n\nexport type Emitter = {\n on(type: string, handler: Handler): void;\n emit(type: string, event?: unknown): void;\n off(type: string, handler: Handler): void;\n};\n\nexport type Arguments<T> = T extends (...payload: infer U) => unknown\n ? U\n : unknown;\n\nexport enum ReplayerEvents {\n Start = 'start',\n Pause = 'pause',\n Resume = 'resume',\n Resize = 'resize',\n Finish = 'finish',\n FullsnapshotRebuilded = 'fullsnapshot-rebuilded',\n LoadStylesheetStart = 'load-stylesheet-start',\n LoadStylesheetEnd = 'load-stylesheet-end',\n SkipStart = 'skip-start',\n SkipEnd = 'skip-end',\n MouseInteraction = 'mouse-interaction',\n EventCast = 'event-cast',\n CustomEvent = 'custom-event',\n Flush = 'flush',\n StateChange = 'state-change',\n PlayBack = 'play-back',\n}\n\n// store the state that would be changed during the process(unmount from dom and mount again)\nexport type ElementState = {\n // [scrollLeft,scrollTop]\n scroll?: [number, number];\n};\n\nexport type KeepIframeSrcFn = (src: string) => boolean;\n\nexport interface HighlightConfiguration {\n enableOnHoverClass?: boolean;\n}\n\ndeclare global {\n interface Window {\n HIG_CONFIGURATION: HighlightConfiguration;\n FontFace: typeof FontFace;\n }\n}\n\nexport type IWindow = Window & typeof globalThis;\n","export enum NodeType {\n Document,\n DocumentType,\n Element,\n Text,\n CDATA,\n Comment,\n}\n\nexport type documentNode = {\n type: NodeType.Document;\n childNodes: serializedNodeWithId[];\n compatMode?: string;\n};\n\nexport type documentTypeNode = {\n type: NodeType.DocumentType;\n name: string;\n publicId: string;\n systemId: string;\n};\n\nexport type attributes = {\n [key: string]: string | number | boolean;\n};\nexport type elementNode = {\n type: NodeType.Element;\n tagName: string;\n attributes: attributes;\n childNodes: serializedNodeWithId[];\n isSVG?: true;\n needBlock?: boolean;\n};\n\nexport type textNode = {\n type: NodeType.Text;\n textContent: string;\n isStyle?: true;\n};\n\nexport type cdataNode = {\n type: NodeType.CDATA;\n textContent: '';\n};\n\nexport type commentNode = {\n type: NodeType.Comment;\n textContent: string;\n};\n\nexport type serializedNode = (\n | documentNode\n | documentTypeNode\n | elementNode\n | textNode\n | cdataNode\n | commentNode\n) & {\n rootId?: number;\n isShadowHost?: boolean;\n isShadow?: boolean;\n};\n\nexport type serializedNodeWithId = serializedNode & { id: number };\n\nexport type tagMap = {\n [key: string]: string;\n};\n\nexport interface INode extends Node {\n __sn: serializedNodeWithId;\n}\n\nexport interface ICanvas extends HTMLCanvasElement {\n __context: string;\n}\n\nexport type idNodeMap = {\n [key: number]: INode;\n};\n\nexport type MaskInputOptions = Partial<{\n color: boolean;\n date: boolean;\n 'datetime-local': boolean;\n email: boolean;\n month: boolean;\n number: boolean;\n range: boolean;\n search: boolean;\n tel: boolean;\n text: boolean;\n time: boolean;\n url: boolean;\n week: boolean;\n // unify textarea and select element with text input\n textarea: boolean;\n select: boolean;\n password: boolean;\n}>;\n\nexport type SlimDOMOptions = Partial<{\n script: boolean;\n comment: boolean;\n headFavicon: boolean;\n headWhitespace: boolean;\n headMetaDescKeywords: boolean;\n headMetaSocial: boolean;\n headMetaRobots: boolean;\n headMetaHttpEquiv: boolean;\n headMetaAuthorship: boolean;\n headMetaVerification: boolean;\n}>;\n\nexport type MaskTextFn = (text: string) => string;\nexport type MaskInputFn = (text: string) => string;\n\nexport type KeepIframeSrcFn = (src: string) => boolean;\n\nexport type BuildCache = {\n stylesWithHoverClass: Map<string, string>;\n};\n","import {\n Mirror,\n throttleOptions,\n listenerHandler,\n hookResetter,\n blockClass,\n eventWithTime,\n EventType,\n IncrementalSource,\n addedNodeMutation,\n removedNodeMutation,\n textMutation,\n attributeMutation,\n mutationData,\n scrollData,\n inputData,\n DocumentDimension,\n IWindow,\n} from './types';\nimport {\n INode,\n IGNORED_NODE,\n serializedNodeWithId,\n NodeType,\n isShadowRoot,\n} from './snapshot';\n\nexport function on(\n type: string,\n fn: EventListenerOrEventListenerObject,\n target: Document | IWindow = document,\n): listenerHandler {\n const options = { capture: true, passive: true };\n target.addEventListener(type, fn, options);\n return () => target.removeEventListener(type, fn, options);\n}\n\nexport function createMirror(): Mirror {\n return {\n map: {},\n getId(n) {\n // if n is not a serialized INode, use -1 as its id.\n if (!n || !n.__sn) {\n return -1;\n }\n return n.__sn.id;\n },\n getNode(id) {\n return this.map[id] || null;\n },\n // TODO: use a weakmap to get rid of manually memory management\n removeNodeFromMap(n) {\n const id = n.__sn && n.__sn.id;\n delete this.map[id];\n if (n.childNodes) {\n n.childNodes.forEach((child) =>\n this.removeNodeFromMap((child as Node) as INode),\n );\n }\n },\n has(id) {\n return this.map.hasOwnProperty(id);\n },\n reset() {\n this.map = {};\n },\n };\n}\n\n// https://github.com/rrweb-io/rrweb/pull/407\nconst DEPARTED_MIRROR_ACCESS_WARNING =\n 'Please stop import mirror directly. Instead of that,' +\n '\\r\\n' +\n 'now you can use replayer.getMirror() to access the mirror instance of a replayer,' +\n '\\r\\n' +\n 'or you can use record.mirror to access the mirror instance during recording.';\nexport let _mirror: Mirror = {\n map: {},\n getId() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n return -1;\n },\n getNode() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n return null;\n },\n removeNodeFromMap() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n },\n has() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n return false;\n },\n reset() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n },\n};\nif (typeof window !== 'undefined' && window.Proxy && window.Reflect) {\n _mirror = new Proxy(_mirror, {\n get(target, prop, receiver) {\n if (prop === 'map') {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n }\n return Reflect.get(target, prop, receiver);\n },\n });\n}\n\n// copy from underscore and modified\nexport function throttle<T>(\n func: (arg: T) => void,\n wait: number,\n options: throttleOptions = {},\n) {\n let timeout: ReturnType<typeof setTimeout> | null = null;\n let previous = 0;\n // tslint:disable-next-line: only-arrow-functions\n return function (arg: T) {\n let now = Date.now();\n if (!previous && options.leading === false) {\n previous = now;\n }\n let remaining = wait - (now - previous);\n let context = this;\n let args = arguments;\n if (remaining <= 0 || remaining > wait) {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n previous = now;\n func.apply(context, args);\n } else if (!timeout && options.trailing !== false) {\n timeout = setTimeout(() => {\n previous = options.leading === false ? 0 : Date.now();\n timeout = null;\n func.apply(context, args);\n }, remaining);\n }\n };\n}\n\nexport function hookSetter<T>(\n target: T,\n key: string | number | symbol,\n d: PropertyDescriptor,\n isRevoked?: boolean,\n win = window,\n): hookResetter {\n const original = win.Object.getOwnPropertyDescriptor(target, key);\n win.Object.defineProperty(\n target,\n key,\n isRevoked\n ? d\n : {\n set(value) {\n // put hooked setter into event loop to avoid of set latency\n setTimeout(() => {\n d.set!.call(this, value);\n }, 0);\n if (original && original.set) {\n original.set.call(this, value);\n }\n },\n },\n );\n return () => hookSetter(target, key, original || {}, true);\n}\n\n// copy from https://github.com/getsentry/sentry-javascript/blob/b2109071975af8bf0316d3b5b38f519bdaf5dc15/packages/utils/src/object.ts\nexport function patch(\n // tslint:disable-next-line:no-any\n source: { [key: string]: any },\n name: string,\n // tslint:disable-next-line:no-any\n replacement: (...args: any[]) => any,\n): () => void {\n try {\n if (!(name in source)) {\n return () => {};\n }\n\n const original = source[name] as () => unknown;\n const wrapped = replacement(original);\n\n // Make sure it's a function first, as we need to attach an empty prototype for `defineProperties` to work\n // otherwise it'll throw \"TypeError: Object.defineProperties called on non-object\"\n // tslint:disable-next-line:strict-type-predicates\n if (typeof wrapped === 'function') {\n wrapped.prototype = wrapped.prototype || {};\n Object.defineProperties(wrapped, {\n __rrweb_original__: {\n enumerable: false,\n value: original,\n },\n });\n }\n\n source[name] = wrapped;\n\n return () => {\n source[name] = original;\n };\n } catch {\n return () => {};\n // This can throw if multiple fill happens on a global object like XMLHttpRequest\n // Fixes https://github.com/getsentry/sentry-javascript/issues/2043\n }\n}\n\nexport function getWindowHeight(): number {\n return (\n window.innerHeight ||\n (document.documentElement && document.documentElement.clientHeight) ||\n (document.body && document.body.clientHeight)\n );\n}\n\nexport function getWindowWidth(): number {\n return (\n window.innerWidth ||\n (document.documentElement && document.documentElement.clientWidth) ||\n (document.body && document.body.clientWidth)\n );\n}\n\n/**\n * Start of Highlight Code\n */\nexport const isCanvasNode = (node: Node | null): boolean => {\n try {\n if (node instanceof HTMLElement) {\n return node.tagName === 'CANVAS';\n }\n } catch {\n return false;\n }\n return false;\n};\n/**\n * End of Highlight Code\n */\n\nexport function isBlocked(node: Node | null, blockClass: blockClass): boolean {\n if (!node) {\n return false;\n }\n if (node.nodeType === node.ELEMENT_NODE) {\n let needBlock = false;\n if (typeof blockClass === 'string') {\n if ((node as HTMLElement).closest !== undefined) {\n return (node as HTMLElement).closest('.' + blockClass) !== null;\n } else {\n needBlock = (node as HTMLElement).classList.contains(blockClass);\n }\n } else {\n (node as HTMLElement).classList.forEach((className) => {\n if (blockClass.test(className)) {\n needBlock = true;\n }\n });\n }\n return needBlock || isBlocked(node.parentNode, blockClass);\n }\n if (node.nodeType === node.TEXT_NODE) {\n // check parent node since text node do not have class name\n return isBlocked(node.parentNode, blockClass);\n }\n return isBlocked(node.parentNode, blockClass);\n}\n\nexport function isIgnored(n: Node | INode): boolean {\n if ('__sn' in n) {\n return (n as INode).__sn.id === IGNORED_NODE;\n }\n // The main part of the slimDOM check happens in\n // rrweb-snapshot::serializeNodeWithId\n return false;\n}\n\nexport function isAncestorRemoved(target: INode, mirror: Mirror): boolean {\n if (isShadowRoot(target)) {\n return false;\n }\n const id = mirror.getId(target);\n if (!mirror.has(id)) {\n return true;\n }\n if (\n target.parentNode &&\n target.parentNode.nodeType === target.DOCUMENT_NODE\n ) {\n return false;\n }\n // if the root is not document, it means the node is not in the DOM tree anymore\n if (!target.parentNode) {\n return true;\n }\n return isAncestorRemoved((target.parentNode as unknown) as INode, mirror);\n}\n\nexport function isTouchEvent(\n event: MouseEvent | TouchEvent,\n): event is TouchEvent {\n return Boolean((event as TouchEvent).changedTouches);\n}\n\nexport function polyfill(win = window) {\n if ('NodeList' in win && !win.NodeList.prototype.forEach) {\n win.NodeList.prototype.forEach = (Array.prototype\n .forEach as unknown) as NodeList['forEach'];\n }\n\n if ('DOMTokenList' in win && !win.DOMTokenList.prototype.forEach) {\n win.DOMTokenList.prototype.forEach = (Array.prototype\n .forEach as unknown) as DOMTokenList['forEach'];\n }\n\n // https://github.com/Financial-Times/polyfill-service/pull/183\n if (!Node.prototype.contains) {\n Node.prototype.contains = function contains(node) {\n if (!(0 in arguments)) {\n throw new TypeError('1 argument is required');\n }\n\n do {\n if (this === node) {\n return true;\n }\n // tslint:disable-next-line: no-conditional-assignment\n } while ((node = node && node.parentNode));\n\n return false;\n };\n }\n}\n\nexport type TreeNode = {\n id: number;\n mutation: addedNodeMutation;\n parent?: TreeNode;\n children: Record<number, TreeNode>;\n texts: textMutation[];\n attributes: attributeMutation[];\n};\nexport class TreeIndex {\n public tree!: Record<number, TreeNode>;\n\n private removeNodeMutations!: removedNodeMutation[];\n private textMutations!: textMutation[];\n private attributeMutations!: attributeMutation[];\n private indexes!: Map<number, TreeNode>;\n private removeIdSet!: Set<number>;\n private scrollMap!: Map<number, scrollData>;\n private inputMap!: Map<number, inputData>;\n\n constructor() {\n this.reset();\n }\n\n public add(mutation: addedNodeMutation) {\n const parentTreeNode = this.indexes.get(mutation.parentId);\n const treeNode: TreeNode = {\n id: mutation.node.id,\n mutation,\n children: [],\n texts: [],\n attributes: [],\n };\n if (!parentTreeNode) {\n this.tree[treeNode.id] = treeNode;\n } else {\n treeNode.parent = parentTreeNode;\n parentTreeNode.children[treeNode.id] = treeNode;\n }\n this.indexes.set(treeNode.id, treeNode);\n }\n\n public remove(mutation: removedNodeMutation, mirror: Mirror) {\n const parentTreeNode = this.indexes.get(mutation.parentId);\n const treeNode = this.indexes.get(mutation.id);\n\n const deepRemoveFromMirror = (id: number) => {\n this.removeIdSet.add(id);\n const node = mirror.getNode(id);\n node?.childNodes.forEach((childNode) => {\n if ('__sn' in childNode) {\n deepRemoveFromMirror(((childNode as unknown) as INode).__sn.id);\n }\n });\n };\n const deepRemoveFromTreeIndex = (node: TreeNode) => {\n this.removeIdSet.add(node.id);\n Object.values(node.children).forEach((n) => deepRemoveFromTreeIndex(n));\n const _treeNode = this.indexes.get(node.id);\n if (_treeNode) {\n const _parentTreeNode = _treeNode.parent;\n if (_parentTreeNode) {\n delete _treeNode.parent;\n delete _parentTreeNode.children[_treeNode.id];\n this.indexes.delete(mutation.id);\n }\n }\n };\n\n if (!treeNode) {\n this.removeNodeMutations.push(mutation);\n deepRemoveFromMirror(mutation.id);\n } else if (!parentTreeNode) {\n delete this.tree[treeNode.id];\n this.indexes.delete(treeNode.id);\n deepRemoveFromTreeIndex(treeNode);\n } else {\n delete treeNode.parent;\n delete parentTreeNode.children[treeNode.id];\n this.indexes.delete(mutation.id);\n deepRemoveFromTreeIndex(treeNode);\n }\n }\n\n public text(mutation: textMutation) {\n const treeNode = this.indexes.get(mutation.id);\n if (treeNode) {\n treeNode.texts.push(mutation);\n } else {\n this.textMutations.push(mutation);\n }\n }\n\n public attribute(mutation: attributeMutation) {\n const treeNode = this.indexes.get(mutation.id);\n if (treeNode) {\n treeNode.attributes.push(mutation);\n } else {\n this.attributeMutations.push(mutation);\n }\n }\n\n public scroll(d: scrollData) {\n this.scrollMap.set(d.id, d);\n }\n\n public input(d: inputData) {\n this.inputMap.set(d.id, d);\n }\n\n public flush(): {\n mutationData: mutationData;\n scrollMap: TreeIndex['scrollMap'];\n inputMap: TreeIndex['inputMap'];\n } {\n const {\n tree,\n removeNodeMutations,\n textMutations,\n attributeMutations,\n } = this;\n\n const batchMutationData: mutationData = {\n source: IncrementalSource.Mutation,\n removes: removeNodeMutations,\n texts: textMutations,\n attributes: attributeMutations,\n adds: [],\n };\n\n const walk = (treeNode: TreeNode, removed: boolean) => {\n if (removed) {\n this.removeIdSet.add(treeNode.id);\n }\n batchMutationData.texts = batchMutationData.texts\n .concat(removed ? [] : treeNode.texts)\n .filter((m) => !this.removeIdSet.has(m.id));\n batchMutationData.attributes = batchMutationData.attributes\n .concat(removed ? [] : treeNode.attributes)\n .filter((m) => !this.removeIdSet.has(m.id));\n if (\n !this.removeIdSet.has(treeNode.id) &&\n !this.removeIdSet.has(treeNode.mutation.parentId) &&\n !removed\n ) {\n batchMutationData.adds.push(treeNode.mutation);\n if (treeNode.children) {\n Object.values(treeNode.children).forEach((n) => walk(n, false));\n }\n } else {\n Object.values(treeNode.children).forEach((n) => walk(n, true));\n }\n };\n\n Object.values(tree).forEach((n) => walk(n, false));\n\n for (const id of this.scrollMap.keys()) {\n if (this.removeIdSet.has(id)) {\n this.scrollMap.delete(id);\n }\n }\n for (const id of this.inputMap.keys()) {\n if (this.removeIdSet.has(id)) {\n this.inputMap.delete(id);\n }\n }\n\n const scrollMap = new Map(this.scrollMap);\n const inputMap = new Map(this.inputMap);\n\n this.reset();\n\n return {\n mutationData: batchMutationData,\n scrollMap,\n inputMap,\n };\n }\n\n private reset() {\n this.tree = [];\n this.indexes = new Map();\n this.removeNodeMutations = [];\n this.textMutations = [];\n this.attributeMutations = [];\n this.removeIdSet = new Set();\n this.scrollMap = new Map();\n this.inputMap = new Map();\n }\n\n public idRemoved(id: number): boolean {\n return this.removeIdSet.has(id);\n }\n}\n\ntype ResolveTree = {\n value: addedNodeMutation;\n children: ResolveTree[];\n parent: ResolveTree | null;\n};\n\nexport function queueToResolveTrees(queue: addedNodeMutation[]): ResolveTree[] {\n const queueNodeMap: Record<number, ResolveTree> = {};\n const putIntoMap = (\n m: addedNodeMutation,\n parent: ResolveTree | null,\n ): ResolveTree => {\n const nodeInTree: ResolveTree = {\n value: m,\n parent,\n children: [],\n };\n queueNodeMap[m.node.id] = nodeInTree;\n return nodeInTree;\n };\n\n const queueNodeTrees: ResolveTree[] = [];\n for (const mutation of queue) {\n const { nextId, parentId } = mutation;\n if (nextId && nextId in queueNodeMap) {\n const nextInTree = queueNodeMap[nextId];\n if (nextInTree.parent) {\n const idx = nextInTree.parent.children.indexOf(nextInTree);\n nextInTree.parent.children.splice(\n idx,\n 0,\n putIntoMap(mutation, nextInTree.parent),\n );\n } else {\n const idx = queueNodeTrees.indexOf(nextInTree);\n queueNodeTrees.splice(idx, 0, putIntoMap(mutation, null));\n }\n continue;\n }\n if (parentId in queueNodeMap) {\n const parentInTree = queueNodeMap[parentId];\n parentInTree.children.push(putIntoMap(mutation, parentInTree));\n continue;\n }\n queueNodeTrees.push(putIntoMap(mutation, null));\n }\n\n return queueNodeTrees;\n}\n\nexport function iterateResolveTree(\n tree: ResolveTree,\n cb: (mutation: addedNodeMutation) => unknown,\n) {\n cb(tree.value);\n /**\n * The resolve tree was designed to reflect the DOM layout,\n * but we need append next sibling first, so we do a reverse\n * loop here.\n */\n for (let i = tree.children.length - 1; i >= 0; i--) {\n iterateResolveTree(tree.children[i], cb);\n }\n}\n\ntype HTMLIFrameINode = HTMLIFrameElement & {\n __sn: serializedNodeWithId;\n};\nexport type AppendedIframe = {\n mutationInQueue: addedNodeMutation;\n builtNode: HTMLIFrameINode;\n};\n\nexport function isIframeINode(\n node: INode | ShadowRoot,\n): node is HTMLIFrameINode {\n if ('__sn' in node) {\n return (\n node.__sn.type === NodeType.Element && node.__sn.tagName === 'iframe'\n );\n }\n // node can be document fragment when using the virtual parent feature\n return false;\n}\n\nexport function getBaseDimension(\n node: Node,\n rootIframe: Node,\n): DocumentDimension {\n const frameElement = node.ownerDocument?.defaultView?.frameElement;\n if (!frameElement || frameElement === rootIframe) {\n return {\n x: 0,\n y: 0,\n relativeScale: 1,\n absoluteScale: 1,\n };\n }\n\n const frameDimension = frameElement.getBoundingClientRect();\n const frameBaseDimension = getBaseDimension(frameElement, rootIframe);\n // the iframe element may have a scale transform\n const relativeScale = frameDimension.height / frameElement.clientHeight;\n return {\n x:\n frameDimension.x * frameBaseDimension.relativeScale +\n frameBaseDimension.x,\n y:\n frameDimension.y * frameBaseDimension.relativeScale +\n frameBaseDimension.y,\n relativeScale,\n absoluteScale: frameBaseDimension.absoluteScale * relativeScale,\n };\n}\n\nexport function hasShadowRoot<T extends Node>(\n n: T,\n): n is T & { shadowRoot: ShadowRoot } {\n return Boolean(((n as unknown) as Element)?.shadowRoot);\n}\n\n/**\n * Returns a string of the same length that has been obfuscated.\n */\nexport function obfuscateText(text: string): string {\n // We remove non-printing characters.\n // For example: '&zwnj;' is a character that isn't shown visibly or takes up layout space on the screen. However if you take the length of the string, it's counted as 1.\n // For example: \"&zwnj;1\"'s length is 2 but visually it's only taking up 1 character width.\n // If we don't filter does out, our string obfuscation could have more characters than what was originally presented.\n text = text.replace(/[^ -~]+/g, '');\n text =\n text\n ?.split(' ')\n .map((word) => Math.random().toString(20).substr(2, word.length))\n .join(' ') || '';\n return text;\n}\n","import { listenerHandler, RecordPlugin } from '../../../types';\nimport { stringify } from './stringify';\nimport { StackFrame, ErrorStackParser } from './error-stack-parser';\nimport { patch } from '../../../utils';\n\nexport type StringifyOptions = {\n // limit of string length\n stringLengthLimit?: number;\n /**\n * limit of number of keys in an object\n * if an object contains more keys than this limit, we would call its toString function directly\n */\n numOfKeysLimit: number;\n};\n\ntype LogRecordOptions = {\n level?: LogLevel[] | undefined;\n lengthThreshold?: number;\n stringifyOptions?: StringifyOptions;\n logger?: Logger | string;\n};\n\nconst defaultLogOptions: LogRecordOptions = {\n level: [\n 'assert',\n 'clear',\n 'count',\n 'countReset',\n 'debug',\n 'dir',\n 'dirxml',\n 'error',\n 'group',\n 'groupCollapsed',\n 'groupEnd',\n 'info',\n 'log',\n 'table',\n 'time',\n 'timeEnd',\n 'timeLog',\n 'trace',\n 'warn',\n ],\n lengthThreshold: 1000,\n logger: 'console',\n};\n\nexport type LogData = {\n level: LogLevel;\n trace: string[];\n payload: string[];\n};\n\ntype logCallback = (p: LogData) => void;\n\nexport type LogLevel =\n | 'assert'\n | 'clear'\n | 'count'\n | 'countReset'\n | 'debug'\n | 'dir'\n | 'dirxml'\n | 'error'\n | 'group'\n | 'groupCollapsed'\n | 'groupEnd'\n | 'info'\n | 'log'\n | 'table'\n | 'time'\n | 'timeEnd'\n | 'timeLog'\n | 'trace'\n | 'warn';\n\n/* fork from interface Console */\n// all kinds of console functions\nexport type Logger = {\n assert?: typeof console.assert;\n clear?: typeof console.clear;\n count?: typeof console.count;\n countReset?: typeof console.countReset;\n debug?: typeof console.debug;\n dir?: typeof console.dir;\n dirxml?: typeof console.dirxml;\n error?: typeof console.error;\n group?: typeof console.group;\n groupCollapsed?: typeof console.groupCollapsed;\n groupEnd?: () => void;\n info?: typeof console.info;\n log?: typeof console.log;\n table?: typeof console.table;\n time?: typeof console.time;\n timeEnd?: typeof console.timeEnd;\n timeLog?: typeof console.timeLog;\n trace?: typeof console.trace;\n warn?: typeof console.warn;\n};\n\nfunction initLogObserver(\n cb: logCallback,\n win: Window, // top window or in an iframe\n logOptions: LogRecordOptions,\n): listenerHandler {\n const loggerType = logOptions.logger;\n if (!loggerType) {\n return () => {};\n }\n let logger: Logger;\n if (typeof loggerType === 'string') {\n logger = (win as any)[loggerType];\n } else {\n logger = loggerType;\n }\n let logCount = 0;\n const cancelHandlers: listenerHandler[] = [];\n // add listener to thrown errors\n if (logOptions.level!.includes('error')) {\n if (window) {\n const originalOnError = window.onerror;\n window.onerror = (\n msg: Event | string,\n file: string,\n line: number,\n col: number,\n error: Error,\n ) => {\n if (originalOnError) {\n originalOnError.apply(this, [msg, file, line, col, error]);\n }\n const trace: string[] = ErrorStackParser.parse(\n error,\n ).map((stackFrame: StackFrame) => stackFrame.toString());\n const payload = [stringify(msg, logOptions.stringifyOptions)];\n cb({\n level: 'error',\n trace,\n payload,\n });\n };\n cancelHandlers.push(() => {\n window.onerror = originalOnError;\n });\n }\n }\n for (const levelType of logOptions.level!) {\n cancelHandlers.push(replace(logger, levelType));\n }\n return () => {\n cancelHandlers.forEach((h) => h());\n };\n\n /**\n * replace the original console function and record logs\n * @param logger the logger object such as Console\n * @param level the name of log function to be replaced\n */\n function replace(_logger: Logger, level: LogLevel) {\n if (!_logger[level]) {\n return () => {};\n }\n // replace the logger.{level}. return a restore function\n return patch(_logger, level, (original) => {\n return (...args: Array<unknown>) => {\n original.apply(this, args);\n try {\n const trace = ErrorStackParser.parse(new Error())\n .map((stackFrame: StackFrame) => stackFrame.toString())\n .splice(1); // splice(1) to omit the hijacked log function\n const payload = args.map((s) =>\n stringify(s, logOptions.stringifyOptions),\n );\n logCount++;\n if (logCount < logOptions.lengthThreshold!) {\n cb({\n level,\n trace,\n payload,\n });\n } else if (logCount === logOptions.lengthThreshold) {\n // notify the user\n cb({\n level: 'warn',\n trace: [],\n payload: [\n stringify('The number of log records reached the threshold.'),\n ],\n });\n }\n } catch (error) {\n original('rrweb logger error:', error, ...args);\n }\n };\n });\n }\n}\n\nexport const PLUGIN_NAME = 'rrweb/console@1';\n\nexport const getRecordConsolePlugin: (\n options?: LogRecordOptions,\n) => RecordPlugin = (options) => ({\n name: PLUGIN_NAME,\n observer: initLogObserver,\n options: options\n ? Object.assign({}, defaultLogOptions, options)\n : defaultLogOptions,\n});\n"],"names":["__read","o","n","m","Symbol","iterator","r","e","i","call","ar","next","done","push","value","error","__spread","arguments","length","concat","pathToSelector","node","outerHTML","path","parentElement","name_1","localName","toLowerCase","parent_1","domSiblings","children","sibling","indexOf","stringify","obj","stringifyOptions","options","numOfKeysLimit","Object","assign","stack","keys","JSON","key","thisPos","this","splice","Infinity","slice","join","_obj","shouldToString","str","toString","stringLengthLimit","Event","eventResult","eventKey","eventValue","Array","isArray","Node","HTMLElement","nodeName","EventType","IncrementalSource","MouseInteractions","CanvasContext","MediaInteractions","ReplayerEvents","NodeType","fileName","functionName","lineNumber","columnNumber","StackFrame","FIREFOX_SAFARI_STACK_REGEXP","CHROME_IE_STACK_REGEXP","SAFARI_NATIVE_CODE_REGEXP","ErrorStackParser","parse","stacktrace","parseOpera","match","parseV8OrIE","parseFFOrSafari","Error","extractLocation","urlLike","parts","exec","replace","undefined","split","filter","line","map","sanitizedLine","location","tokens","locationParts","pop","functionNameRegex","matches","message","parseOpera9","parseOpera11","parseOpera10","lineRE","lines","result","len","parseFloat","shift","DEPARTED_MIRROR_ACCESS_WARNING","_mirror","getId","console","getNode","removeNodeFromMap","has","reset","window","Proxy","Reflect","get","target","prop","receiver","defaultLogOptions","level","lengthThreshold","logger","initLogObserver","cb","win","logOptions","loggerType","logCount","cancelHandlers","includes","originalOnError_1","onerror","msg","file","col","apply","_this","trace","stackFrame","payload","_b","s","TypeError","__values","levelType","forEach","h","_logger","source","name","replacement","original_1","wrapped","prototype","defineProperties","__rrweb_original__","enumerable","patch","original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AMD,KAAQD,GACZ,OAAO,aAGT,IAAMG,EAAWH,EAAOC,GAClBG,EAAUF,EAAYC,GAiB5B,MAZuB,mBAAZC,IACTA,EAAQC,UAAYD,EAAQC,WAAa,GACzC9H,OAAO+H,iBAAiBF,EAAS,CAC/BG,mBAAoB,CAClBC,YAAY,EACZzJ,MAAOoJ,MAKbH,EAAOC,GAAQG,EAER,WACLJ,EAAOC,GAAQE,GAEjB,SACA,OAAO,cCzCAM,CAAMV,EAAS5B,GAAO,SAACuC,GAC5B,OAAO,eAAC,aAAAC,mBAAAA,IAAAC,kBACNF,EAASvB,MAAMC,EAAMwB,GACrB,IACE,IAAMvB,EAAQrE,EAAiBC,MAAM,IAAIM,OACtCU,KAAI,SAACqD,GAA2B,OAAAA,EAAWhG,cAC3CP,OAAO,GACJwG,EAAUqB,EAAK3E,KAAI,SAACwD,GACxB,OAAAvH,EAAUuH,EAAGhB,EAAWrG,uBAE1BuG,EACeF,EAAWL,gBACxBG,EAAG,CACDJ,QACAkB,QACAE,YAEOZ,IAAaF,EAAWL,iBAEjCG,EAAG,CACDJ,MAAO,OACPkB,MAAO,GACPE,QAAS,CACPrH,EAAU,uDAIhB,MAAOlB,GACP0J,kBAAS,sBAAuB1J,GAAU4J,SA/BvC,mCAsCc,2CAIP,SAACvI,GAAY,OAC/B4H,KALyB,kBAMzBY,SAAUvC,EACVjG,QAASA,EACLE,OAAOC,OAAO,GAAI0F,EAAmB7F,GACrC6F"}
1
+ {"version":3,"file":"console-record.min.js","sources":["../../node_modules/tslib/tslib.es6.js","../../../src/types.ts","../../../rrweb-snapshot/es/rrweb-snapshot.js","../../../src/utils.ts","../../../src/plugins/console/record/error-stack-parser.ts","../../../src/plugins/console/record/stringify.ts","../../../src/plugins/console/record/index.ts"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n","import {\n serializedNodeWithId,\n idNodeMap,\n INode,\n MaskInputOptions,\n SlimDOMOptions,\n MaskInputFn,\n MaskTextFn,\n} from '@highlight-run/rrweb-snapshot';\nimport { PackFn, UnpackFn } from './packer/base';\nimport { IframeManager } from './record/iframe-manager';\nimport { ShadowDomManager } from './record/shadow-dom-manager';\nimport type { Replayer } from './replay';\nimport { CanvasManager } from './record/observers/canvas/canvas-manager';\n\nexport enum EventType {\n DomContentLoaded,\n Load,\n FullSnapshot,\n IncrementalSnapshot,\n Meta,\n Custom,\n Plugin,\n}\n\nexport type SessionInterval = {\n startTime: number;\n endTime: number;\n duration: number;\n active: boolean;\n};\n\nexport type domContentLoadedEvent = {\n type: EventType.DomContentLoaded;\n data: {};\n};\n\nexport type loadedEvent = {\n type: EventType.Load;\n data: {};\n};\n\nexport type fullSnapshotEvent = {\n type: EventType.FullSnapshot;\n data: {\n node: serializedNodeWithId;\n initialOffset: {\n top: number;\n left: number;\n };\n };\n};\n\nexport type incrementalSnapshotEvent = {\n type: EventType.IncrementalSnapshot;\n data: incrementalData;\n};\n\nexport type metaEvent = {\n type: EventType.Meta;\n data: {\n href: string;\n width: number;\n height: number;\n };\n};\n\nexport type customEvent<T = unknown> = {\n type: EventType.Custom;\n data: {\n tag: string;\n payload: T;\n };\n};\n\nexport type pluginEvent<T = unknown> = {\n type: EventType.Plugin;\n data: {\n plugin: string;\n payload: T;\n };\n};\n\nexport type styleSheetEvent = {};\n\nexport enum IncrementalSource {\n Mutation,\n MouseMove,\n MouseInteraction,\n Scroll,\n ViewportResize,\n Input,\n TouchMove,\n MediaInteraction,\n StyleSheetRule,\n CanvasMutation,\n Font,\n Log,\n Drag,\n StyleDeclaration,\n}\n\nexport type mutationData = {\n source: IncrementalSource.Mutation;\n} & mutationCallbackParam;\n\nexport type mousemoveData = {\n source:\n | IncrementalSource.MouseMove\n | IncrementalSource.TouchMove\n | IncrementalSource.Drag;\n positions: mousePosition[];\n};\n\nexport type mouseInteractionData = {\n source: IncrementalSource.MouseInteraction;\n} & mouseInteractionParam;\n\nexport type scrollData = {\n source: IncrementalSource.Scroll;\n} & scrollPosition;\n\nexport type viewportResizeData = {\n source: IncrementalSource.ViewportResize;\n} & viewportResizeDimension;\n\nexport type inputData = {\n source: IncrementalSource.Input;\n id: number;\n} & inputValue;\n\nexport type mediaInteractionData = {\n source: IncrementalSource.MediaInteraction;\n} & mediaInteractionParam;\n\nexport type styleSheetRuleData = {\n source: IncrementalSource.StyleSheetRule;\n} & styleSheetRuleParam;\n\nexport type styleDeclarationData = {\n source: IncrementalSource.StyleDeclaration;\n} & styleDeclarationParam;\n\nexport type canvasMutationData = {\n source: IncrementalSource.CanvasMutation;\n} & canvasMutationParam;\n\nexport type fontData = {\n source: IncrementalSource.Font;\n} & fontParam;\n\nexport type incrementalData =\n | mutationData\n | mousemoveData\n | mouseInteractionData\n | scrollData\n | viewportResizeData\n | inputData\n | mediaInteractionData\n | styleSheetRuleData\n | canvasMutationData\n | fontData\n | styleDeclarationData;\n\nexport type event =\n | domContentLoadedEvent\n | loadedEvent\n | fullSnapshotEvent\n | incrementalSnapshotEvent\n | metaEvent\n | customEvent\n | pluginEvent;\n\nexport type eventWithTime = event & {\n timestamp: number;\n delay?: number;\n};\n\nexport type blockClass = string | RegExp;\n\nexport type maskTextClass = string | RegExp;\n\nexport type SamplingStrategy = Partial<{\n /**\n * false means not to record mouse/touch move events\n * number is the throttle threshold of recording mouse/touch move\n */\n mousemove: boolean | number;\n /**\n * number is the throttle threshold of mouse/touch move callback\n */\n mousemoveCallback: number;\n /**\n * false means not to record mouse interaction events\n * can also specify record some kinds of mouse interactions\n */\n mouseInteraction: boolean | Record<string, boolean | undefined>;\n /**\n * number is the throttle threshold of recording scroll\n */\n scroll: number;\n /**\n * number is the throttle threshold of recording media interactions\n */\n media: number;\n /**\n * 'all' will record all the input events\n * 'last' will only record the last input value while input a sequence of chars\n */\n input: 'all' | 'last';\n}>;\n\nexport type RecordPlugin<TOptions = unknown> = {\n name: string;\n observer?: (cb: Function, win: IWindow, options: TOptions) => listenerHandler;\n eventProcessor?: <TExtend>(event: eventWithTime) => eventWithTime & TExtend;\n options: TOptions;\n};\n\nexport type recordOptions<T> = {\n emit?: (e: T, isCheckout?: boolean) => void;\n checkoutEveryNth?: number;\n checkoutEveryNms?: number;\n blockClass?: blockClass;\n blockSelector?: string;\n ignoreClass?: string;\n maskTextClass?: maskTextClass;\n maskTextSelector?: string;\n maskAllInputs?: boolean;\n maskInputOptions?: MaskInputOptions;\n maskInputFn?: MaskInputFn;\n maskTextFn?: MaskTextFn;\n slimDOMOptions?: SlimDOMOptions | 'all' | true;\n inlineStylesheet?: boolean;\n hooks?: hooksParam;\n packFn?: PackFn;\n sampling?: SamplingStrategy;\n recordCanvas?: boolean;\n userTriggeredOnInput?: boolean;\n collectFonts?: boolean;\n inlineImages?: boolean;\n plugins?: RecordPlugin[];\n // departed, please use sampling options\n mousemoveWait?: number;\n keepIframeSrcFn?: KeepIframeSrcFn;\n /**\n * Enabling this will disable recording of text data on the page. This is useful if you do not want to record personally identifiable information.\n * Text will be randomized. Instead of seeing \"Hello World\" in a recording, you will see \"1fds1 j59a0\".\n */\n enableStrictPrivacy?: boolean;\n};\n\nexport type observerParam = {\n mutationCb: mutationCallBack;\n mousemoveCb: mousemoveCallBack;\n mouseInteractionCb: mouseInteractionCallBack;\n scrollCb: scrollCallback;\n viewportResizeCb: viewportResizeCallback;\n inputCb: inputCallback;\n mediaInteractionCb: mediaInteractionCallback;\n blockClass: blockClass;\n blockSelector: string | null;\n ignoreClass: string;\n maskTextClass: maskTextClass;\n maskTextSelector: string | null;\n maskInputOptions: MaskInputOptions;\n maskInputFn?: MaskInputFn;\n maskTextFn?: MaskTextFn;\n inlineStylesheet: boolean;\n styleSheetRuleCb: styleSheetRuleCallback;\n styleDeclarationCb: styleDeclarationCallback;\n canvasMutationCb: canvasMutationCallback;\n fontCb: fontCallback;\n sampling: SamplingStrategy;\n recordCanvas: boolean;\n inlineImages: boolean;\n userTriggeredOnInput: boolean;\n collectFonts: boolean;\n slimDOMOptions: SlimDOMOptions;\n doc: Document;\n mirror: Mirror;\n iframeManager: IframeManager;\n shadowDomManager: ShadowDomManager;\n canvasManager: CanvasManager;\n enableStrictPrivacy: boolean,\n plugins: Array<{\n observer: Function;\n callback: Function;\n options: unknown;\n }>;\n};\n\nexport type MutationBufferParam = Pick<\n observerParam,\n | 'mutationCb'\n | 'blockClass'\n | 'blockSelector'\n | 'maskTextClass'\n | 'maskTextSelector'\n | 'inlineStylesheet'\n | 'maskInputOptions'\n | 'maskTextFn'\n | 'maskInputFn'\n | 'recordCanvas'\n | 'inlineImages'\n | 'slimDOMOptions'\n | 'doc'\n | 'mirror'\n | 'iframeManager'\n | 'shadowDomManager'\n | 'canvasManager'\n | 'enableStrictPrivacy'\n>;\n\nexport type hooksParam = {\n mutation?: mutationCallBack;\n mousemove?: mousemoveCallBack;\n mouseInteraction?: mouseInteractionCallBack;\n scroll?: scrollCallback;\n viewportResize?: viewportResizeCallback;\n input?: inputCallback;\n mediaInteaction?: mediaInteractionCallback;\n styleSheetRule?: styleSheetRuleCallback;\n styleDeclaration?: styleDeclarationCallback;\n canvasMutation?: canvasMutationCallback;\n font?: fontCallback;\n};\n\n// https://dom.spec.whatwg.org/#interface-mutationrecord\nexport type mutationRecord = {\n type: string;\n target: Node;\n oldValue: string | null;\n addedNodes: NodeList;\n removedNodes: NodeList;\n attributeName: string | null;\n};\n\nexport type textCursor = {\n node: Node;\n value: string | null;\n};\nexport type textMutation = {\n id: number;\n value: string | null;\n};\n\nexport type styleAttributeValue = {\n [key: string]: styleValueWithPriority | string | false;\n};\n\nexport type styleValueWithPriority = [string, string];\n\nexport type attributeCursor = {\n node: Node;\n attributes: {\n [key: string]: string | styleAttributeValue | null;\n };\n};\nexport type attributeMutation = {\n id: number;\n attributes: {\n [key: string]: string | styleAttributeValue | null;\n };\n};\n\nexport type removedNodeMutation = {\n parentId: number;\n id: number;\n isShadow?: boolean;\n};\n\nexport type addedNodeMutation = {\n parentId: number;\n // Newly recorded mutations will not have previousId any more, just for compatibility\n previousId?: number | null;\n nextId: number | null;\n node: serializedNodeWithId;\n};\n\nexport type mutationCallbackParam = {\n texts: textMutation[];\n attributes: attributeMutation[];\n removes: removedNodeMutation[];\n adds: addedNodeMutation[];\n isAttachIframe?: true;\n};\n\nexport type mutationCallBack = (m: mutationCallbackParam) => void;\n\nexport type mousemoveCallBack = (\n p: mousePosition[],\n source:\n | IncrementalSource.MouseMove\n | IncrementalSource.TouchMove\n | IncrementalSource.Drag,\n) => void;\n\nexport type mousePosition = {\n x: number;\n y: number;\n id: number;\n timeOffset: number;\n};\n\nexport type mouseMovePos = {\n x: number;\n y: number;\n id: number;\n debugData: incrementalData;\n};\n\nexport enum MouseInteractions {\n MouseUp,\n MouseDown,\n Click,\n ContextMenu,\n DblClick,\n Focus,\n Blur,\n TouchStart,\n TouchMove_Departed, // we will start a separate observer for touch move event\n TouchEnd,\n TouchCancel,\n}\n\nexport enum CanvasContext {\n '2D',\n WebGL,\n WebGL2,\n}\n\nexport type SerializedWebGlArg =\n | {\n rr_type: 'ArrayBuffer';\n base64: string; // base64\n }\n | {\n rr_type: string;\n src: string; // url of image\n }\n | {\n rr_type: string;\n args: SerializedWebGlArg[];\n }\n | {\n rr_type: string;\n index: number;\n }\n | string\n | number\n | boolean\n | null\n | SerializedWebGlArg[];\n\ntype mouseInteractionParam = {\n type: MouseInteractions;\n id: number;\n x: number;\n y: number;\n};\n\nexport type mouseInteractionCallBack = (d: mouseInteractionParam) => void;\n\nexport type scrollPosition = {\n id: number;\n x: number;\n y: number;\n};\n\nexport type scrollCallback = (p: scrollPosition) => void;\n\nexport type styleSheetAddRule = {\n rule: string;\n index?: number | number[];\n};\n\nexport type styleSheetDeleteRule = {\n index: number | number[];\n};\n\nexport type styleSheetRuleParam = {\n id: number;\n removes?: styleSheetDeleteRule[];\n adds?: styleSheetAddRule[];\n};\n\nexport type styleSheetRuleCallback = (s: styleSheetRuleParam) => void;\n\nexport type styleDeclarationParam = {\n id: number;\n index: number[];\n set?: {\n property: string;\n value: string | null;\n priority: string | undefined;\n };\n remove?: {\n property: string;\n };\n};\n\nexport type styleDeclarationCallback = (s: styleDeclarationParam) => void;\n\nexport type canvasMutationCommand = {\n property: string;\n args: Array<unknown>;\n setter?: true;\n};\n\nexport type canvasMutationParam =\n | {\n id: number;\n type: CanvasContext;\n commands: canvasMutationCommand[];\n }\n | ({\n id: number;\n type: CanvasContext;\n } & canvasMutationCommand);\n\nexport type canvasMutationWithType = {\n type: CanvasContext;\n} & canvasMutationCommand;\n\nexport type canvasMutationCallback = (p: canvasMutationParam) => void;\n\nexport type canvasManagerMutationCallback = (\n target: HTMLCanvasElement,\n p: canvasMutationWithType,\n) => void;\n\nexport type fontParam = {\n family: string;\n fontSource: string;\n buffer: boolean;\n descriptors?: FontFaceDescriptors;\n};\n\nexport type fontCallback = (p: fontParam) => void;\n\nexport type viewportResizeDimension = {\n width: number;\n height: number;\n};\n\nexport type viewportResizeCallback = (d: viewportResizeDimension) => void;\n\nexport type inputValue = {\n text: string;\n isChecked: boolean;\n\n // `userTriggered` indicates if this event was triggered directly by user (userTriggered: true)\n // or was triggered indirectly (userTriggered: false)\n // Example of `userTriggered` in action:\n // User clicks on radio element (userTriggered: true) which triggers the other radio element to change (userTriggered: false)\n userTriggered?: boolean;\n};\n\nexport type inputCallback = (v: inputValue & { id: number }) => void;\n\nexport const enum MediaInteractions {\n Play,\n Pause,\n Seeked,\n VolumeChange,\n}\n\nexport type mediaInteractionParam = {\n type: MediaInteractions;\n id: number;\n currentTime?: number;\n volume?: number;\n muted?: boolean;\n};\n\nexport type mediaInteractionCallback = (p: mediaInteractionParam) => void;\n\nexport type DocumentDimension = {\n x: number;\n y: number;\n // scale value relative to its parent iframe\n relativeScale: number;\n // scale value relative to the root iframe\n absoluteScale: number;\n};\n\nexport type Mirror = {\n map: idNodeMap;\n getId: (n: INode) => number;\n getNode: (id: number) => INode | null;\n removeNodeFromMap: (n: INode) => void;\n has: (id: number) => boolean;\n reset: () => void;\n};\n\nexport type throttleOptions = {\n leading?: boolean;\n trailing?: boolean;\n};\n\nexport type listenerHandler = () => void;\nexport type hookResetter = () => void;\n\nexport type ReplayPlugin = {\n handler: (\n event: eventWithTime,\n isSync: boolean,\n context: { replayer: Replayer },\n ) => void;\n};\nexport type playerConfig = {\n speed: number;\n maxSpeed: number;\n root: Element;\n loadTimeout: number;\n skipInactive: boolean;\n showWarning: boolean;\n showDebug: boolean;\n blockClass: string;\n liveMode: boolean;\n insertStyleRules: string[];\n triggerFocus: boolean;\n UNSAFE_replayCanvas: boolean;\n pauseAnimation?: boolean;\n mouseTail:\n | boolean\n | {\n duration?: number;\n lineCap?: string;\n lineWidth?: number;\n strokeStyle?: string;\n };\n unpackFn?: UnpackFn;\n plugins?: ReplayPlugin[];\n inactiveThreshold: number;\n inactiveSkipTime: number;\n};\n\nexport type playerMetaData = {\n startTime: number;\n endTime: number;\n totalTime: number;\n};\n\nexport type missingNode = {\n node: Node;\n mutation: addedNodeMutation;\n};\nexport type missingNodeMap = {\n [id: number]: missingNode;\n};\n\nexport type actionWithDelay = {\n doAction: () => void;\n delay: number;\n};\n\nexport type Handler = (event?: unknown) => void;\n\nexport type Emitter = {\n on(type: string, handler: Handler): void;\n emit(type: string, event?: unknown): void;\n off(type: string, handler: Handler): void;\n};\n\nexport type Arguments<T> = T extends (...payload: infer U) => unknown\n ? U\n : unknown;\n\nexport enum ReplayerEvents {\n Start = 'start',\n Pause = 'pause',\n Resume = 'resume',\n Resize = 'resize',\n Finish = 'finish',\n FullsnapshotRebuilded = 'fullsnapshot-rebuilded',\n LoadStylesheetStart = 'load-stylesheet-start',\n LoadStylesheetEnd = 'load-stylesheet-end',\n SkipStart = 'skip-start',\n SkipEnd = 'skip-end',\n MouseInteraction = 'mouse-interaction',\n EventCast = 'event-cast',\n CustomEvent = 'custom-event',\n Flush = 'flush',\n StateChange = 'state-change',\n PlayBack = 'play-back',\n}\n\n// store the state that would be changed during the process(unmount from dom and mount again)\nexport type ElementState = {\n // [scrollLeft,scrollTop]\n scroll?: [number, number];\n};\n\nexport type KeepIframeSrcFn = (src: string) => boolean;\n\ndeclare global {\n interface Window {\n FontFace: typeof FontFace;\n }\n}\n\nexport type IWindow = Window & typeof globalThis;\n\nexport type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;\n","var NodeType;\n(function (NodeType) {\n NodeType[NodeType[\"Document\"] = 0] = \"Document\";\n NodeType[NodeType[\"DocumentType\"] = 1] = \"DocumentType\";\n NodeType[NodeType[\"Element\"] = 2] = \"Element\";\n NodeType[NodeType[\"Text\"] = 3] = \"Text\";\n NodeType[NodeType[\"CDATA\"] = 4] = \"CDATA\";\n NodeType[NodeType[\"Comment\"] = 5] = \"Comment\";\n})(NodeType || (NodeType = {}));\n\nfunction isElement(n) {\n return n.nodeType === n.ELEMENT_NODE;\n}\nfunction isShadowRoot(n) {\n var _a;\n var host = (_a = n) === null || _a === void 0 ? void 0 : _a.host;\n return Boolean(host && host.shadowRoot && host.shadowRoot === n);\n}\nfunction maskInputValue(_a) {\n var maskInputOptions = _a.maskInputOptions, tagName = _a.tagName, type = _a.type, value = _a.value, maskInputFn = _a.maskInputFn;\n var text = value || '';\n if (maskInputOptions[tagName.toLowerCase()] ||\n maskInputOptions[type]) {\n if (maskInputFn) {\n text = maskInputFn(text);\n }\n else {\n text = '*'.repeat(text.length);\n }\n }\n return text;\n}\nvar ORIGINAL_ATTRIBUTE_NAME = '__rrweb_original__';\nfunction is2DCanvasBlank(canvas) {\n var ctx = canvas.getContext('2d');\n if (!ctx)\n return true;\n var chunkSize = 50;\n for (var x = 0; x < canvas.width; x += chunkSize) {\n for (var y = 0; y < canvas.height; y += chunkSize) {\n var getImageData = ctx.getImageData;\n var originalGetImageData = ORIGINAL_ATTRIBUTE_NAME in getImageData\n ? getImageData[ORIGINAL_ATTRIBUTE_NAME]\n : getImageData;\n var pixelBuffer = new Uint32Array(originalGetImageData.call(ctx, x, y, Math.min(chunkSize, canvas.width - x), Math.min(chunkSize, canvas.height - y)).data.buffer);\n if (pixelBuffer.some(function (pixel) { return pixel !== 0; }))\n return false;\n }\n }\n return true;\n}\nfunction obfuscateText(text) {\n text = text.replace(/[^ -~]+/g, '');\n text =\n (text === null || text === void 0 ? void 0 : text.split(' ').map(function (word) { return Math.random().toString(20).substr(2, word.length); }).join(' ')) || '';\n return text;\n}\n\nvar _id = 1;\nvar tagNameRegex = new RegExp('[^a-z0-9-_:]');\nvar IGNORED_NODE = -2;\nfunction genId() {\n return _id++;\n}\nfunction getValidTagName(element) {\n if (element instanceof HTMLFormElement) {\n return 'form';\n }\n var processedTagName = element.tagName.toLowerCase().trim();\n if (tagNameRegex.test(processedTagName)) {\n return 'div';\n }\n return processedTagName;\n}\nfunction getCssRulesString(s) {\n try {\n var rules = s.rules || s.cssRules;\n return rules ? Array.from(rules).map(getCssRuleString).join('') : null;\n }\n catch (error) {\n return null;\n }\n}\nfunction getCssRuleString(rule) {\n var cssStringified = rule.cssText;\n if (isCSSImportRule(rule)) {\n try {\n cssStringified = getCssRulesString(rule.styleSheet) || cssStringified;\n }\n catch (_a) {\n }\n }\n return cssStringified;\n}\nfunction isCSSImportRule(rule) {\n return 'styleSheet' in rule;\n}\nfunction stringifyStyleSheet(sheet) {\n return sheet.cssRules\n ? Array.from(sheet.cssRules)\n .map(function (rule) { return rule.cssText || ''; })\n .join('')\n : '';\n}\nfunction extractOrigin(url) {\n var origin = '';\n if (url.indexOf('//') > -1) {\n origin = url.split('/').slice(0, 3).join('/');\n }\n else {\n origin = url.split('/')[0];\n }\n origin = origin.split('?')[0];\n return origin;\n}\nvar canvasService;\nvar canvasCtx;\nvar URL_IN_CSS_REF = /url\\((?:(')([^']*)'|(\")(.*?)\"|([^)]*))\\)/gm;\nvar RELATIVE_PATH = /^(?!www\\.|(?:http|ftp)s?:\\/\\/|[A-Za-z]:\\\\|\\/\\/|#).*/;\nvar DATA_URI = /^(data:)([^,]*),(.*)/i;\nfunction absoluteToStylesheet(cssText, href) {\n return (cssText || '').replace(URL_IN_CSS_REF, function (origin, quote1, path1, quote2, path2, path3) {\n var filePath = path1 || path2 || path3;\n var maybeQuote = quote1 || quote2 || '';\n if (!filePath) {\n return origin;\n }\n if (!RELATIVE_PATH.test(filePath)) {\n return \"url(\" + maybeQuote + filePath + maybeQuote + \")\";\n }\n if (DATA_URI.test(filePath)) {\n return \"url(\" + maybeQuote + filePath + maybeQuote + \")\";\n }\n if (filePath[0] === '/') {\n return \"url(\" + maybeQuote + (extractOrigin(href) + filePath) + maybeQuote + \")\";\n }\n var stack = href.split('/');\n var parts = filePath.split('/');\n stack.pop();\n for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {\n var part = parts_1[_i];\n if (part === '.') {\n continue;\n }\n else if (part === '..') {\n stack.pop();\n }\n else {\n stack.push(part);\n }\n }\n return \"url(\" + maybeQuote + stack.join('/') + maybeQuote + \")\";\n });\n}\nvar SRCSET_NOT_SPACES = /^[^ \\t\\n\\r\\u000c]+/;\nvar SRCSET_COMMAS_OR_SPACES = /^[, \\t\\n\\r\\u000c]+/;\nfunction getAbsoluteSrcsetString(doc, attributeValue) {\n if (attributeValue.trim() === '') {\n return attributeValue;\n }\n var pos = 0;\n function collectCharacters(regEx) {\n var chars;\n var match = regEx.exec(attributeValue.substring(pos));\n if (match) {\n chars = match[0];\n pos += chars.length;\n return chars;\n }\n return '';\n }\n var output = [];\n while (true) {\n collectCharacters(SRCSET_COMMAS_OR_SPACES);\n if (pos >= attributeValue.length) {\n break;\n }\n var url = collectCharacters(SRCSET_NOT_SPACES);\n if (url.slice(-1) === ',') {\n url = absoluteToDoc(doc, url.substring(0, url.length - 1));\n output.push(url);\n }\n else {\n var descriptorsStr = '';\n url = absoluteToDoc(doc, url);\n var inParens = false;\n while (true) {\n var c = attributeValue.charAt(pos);\n if (c === '') {\n output.push((url + descriptorsStr).trim());\n break;\n }\n else if (!inParens) {\n if (c === ',') {\n pos += 1;\n output.push((url + descriptorsStr).trim());\n break;\n }\n else if (c === '(') {\n inParens = true;\n }\n }\n else {\n if (c === ')') {\n inParens = false;\n }\n }\n descriptorsStr += c;\n pos += 1;\n }\n }\n }\n return output.join(', ');\n}\nfunction absoluteToDoc(doc, attributeValue) {\n if (!attributeValue || attributeValue.trim() === '') {\n return attributeValue;\n }\n var a = doc.createElement('a');\n a.href = attributeValue;\n return a.href;\n}\nfunction isSVGElement(el) {\n return Boolean(el.tagName === 'svg' || el.ownerSVGElement);\n}\nfunction getHref() {\n var a = document.createElement('a');\n a.href = '';\n return a.href;\n}\nfunction transformAttribute(doc, tagName, name, value) {\n if (name === 'src' || (name === 'href' && value)) {\n return absoluteToDoc(doc, value);\n }\n else if (name === 'xlink:href' && value && value[0] !== '#') {\n return absoluteToDoc(doc, value);\n }\n else if (name === 'background' &&\n value &&\n (tagName === 'table' || tagName === 'td' || tagName === 'th')) {\n return absoluteToDoc(doc, value);\n }\n else if (name === 'srcset' && value) {\n return getAbsoluteSrcsetString(doc, value);\n }\n else if (name === 'style' && value) {\n return absoluteToStylesheet(value, getHref());\n }\n else if (tagName === 'object' && name === 'data' && value) {\n return absoluteToDoc(doc, value);\n }\n else {\n return value;\n }\n}\nfunction _isBlockedElement(element, blockClass, blockSelector) {\n if (typeof blockClass === 'string') {\n if (element.classList.contains(blockClass)) {\n return true;\n }\n }\n else {\n for (var eIndex = 0; eIndex < element.classList.length; eIndex++) {\n var className = element.classList[eIndex];\n if (blockClass.test(className)) {\n return true;\n }\n }\n }\n if (blockSelector) {\n return element.matches(blockSelector);\n }\n return false;\n}\nfunction needMaskingText(node, maskTextClass, maskTextSelector) {\n if (!node) {\n return false;\n }\n if (node.nodeType === node.ELEMENT_NODE) {\n if (typeof maskTextClass === 'string') {\n if (node.classList.contains(maskTextClass)) {\n return true;\n }\n }\n else {\n for (var eIndex = 0; eIndex < node.classList.length; eIndex++) {\n var className = node.classList[eIndex];\n if (maskTextClass.test(className)) {\n return true;\n }\n }\n }\n if (maskTextSelector) {\n if (node.matches(maskTextSelector)) {\n return true;\n }\n }\n return needMaskingText(node.parentNode, maskTextClass, maskTextSelector);\n }\n if (node.nodeType === node.TEXT_NODE) {\n return needMaskingText(node.parentNode, maskTextClass, maskTextSelector);\n }\n return needMaskingText(node.parentNode, maskTextClass, maskTextSelector);\n}\nfunction onceIframeLoaded(iframeEl, listener, iframeLoadTimeout) {\n var win = iframeEl.contentWindow;\n if (!win) {\n return;\n }\n var fired = false;\n var readyState;\n try {\n readyState = win.document.readyState;\n }\n catch (error) {\n return;\n }\n if (readyState !== 'complete') {\n var timer_1 = setTimeout(function () {\n if (!fired) {\n listener();\n fired = true;\n }\n }, iframeLoadTimeout);\n iframeEl.addEventListener('load', function () {\n clearTimeout(timer_1);\n fired = true;\n listener();\n });\n return;\n }\n var blankUrl = 'about:blank';\n if (win.location.href !== blankUrl ||\n iframeEl.src === blankUrl ||\n iframeEl.src === '') {\n setTimeout(listener, 0);\n return;\n }\n iframeEl.addEventListener('load', listener);\n}\nfunction serializeNode(n, options) {\n var _a;\n var doc = options.doc, blockClass = options.blockClass, blockSelector = options.blockSelector, maskTextClass = options.maskTextClass, maskTextSelector = options.maskTextSelector, inlineStylesheet = options.inlineStylesheet, _b = options.maskInputOptions, maskInputOptions = _b === void 0 ? {} : _b, maskTextFn = options.maskTextFn, maskInputFn = options.maskInputFn, _c = options.dataURLOptions, dataURLOptions = _c === void 0 ? {} : _c, inlineImages = options.inlineImages, recordCanvas = options.recordCanvas, keepIframeSrcFn = options.keepIframeSrcFn, enableStrictPrivacy = options.enableStrictPrivacy;\n var rootId;\n if (doc.__sn) {\n var docId = doc.__sn.id;\n rootId = docId === 1 ? undefined : docId;\n }\n switch (n.nodeType) {\n case n.DOCUMENT_NODE:\n if (n.compatMode !== 'CSS1Compat') {\n return {\n type: NodeType.Document,\n childNodes: [],\n compatMode: n.compatMode,\n rootId: rootId\n };\n }\n else {\n return {\n type: NodeType.Document,\n childNodes: [],\n rootId: rootId\n };\n }\n case n.DOCUMENT_TYPE_NODE:\n return {\n type: NodeType.DocumentType,\n name: n.name,\n publicId: n.publicId,\n systemId: n.systemId,\n rootId: rootId\n };\n case n.ELEMENT_NODE:\n var needBlock = _isBlockedElement(n, blockClass, blockSelector);\n var tagName = getValidTagName(n);\n var attributes_1 = {};\n for (var _i = 0, _d = Array.from(n.attributes); _i < _d.length; _i++) {\n var _e = _d[_i], name_1 = _e.name, value = _e.value;\n attributes_1[name_1] = transformAttribute(doc, tagName, name_1, value);\n }\n if (tagName === 'link' && inlineStylesheet) {\n var stylesheet = Array.from(doc.styleSheets).find(function (s) {\n return s.href === n.href;\n });\n var cssText = null;\n if (stylesheet) {\n cssText = getCssRulesString(stylesheet);\n }\n if (cssText) {\n delete attributes_1.rel;\n delete attributes_1.href;\n attributes_1._cssText = absoluteToStylesheet(cssText, stylesheet.href);\n }\n }\n if (tagName === 'style' &&\n n.sheet &&\n !(n.innerText ||\n n.textContent ||\n '').trim().length) {\n var cssText = getCssRulesString(n.sheet);\n if (cssText) {\n attributes_1._cssText = absoluteToStylesheet(cssText, getHref());\n }\n }\n if (tagName === 'input' ||\n tagName === 'textarea' ||\n tagName === 'select') {\n var value = n.value;\n if (attributes_1.type !== 'radio' &&\n attributes_1.type !== 'checkbox' &&\n attributes_1.type !== 'submit' &&\n attributes_1.type !== 'button' &&\n value) {\n attributes_1.value = maskInputValue({\n type: attributes_1.type,\n tagName: tagName,\n value: value,\n maskInputOptions: maskInputOptions,\n maskInputFn: maskInputFn\n });\n }\n else if (n.checked) {\n attributes_1.checked = n.checked;\n }\n }\n if (tagName === 'option') {\n if (n.selected && !maskInputOptions['select']) {\n attributes_1.selected = true;\n }\n else {\n delete attributes_1.selected;\n }\n }\n if (tagName === 'canvas' && recordCanvas) {\n if (n.__context === '2d') {\n if (!is2DCanvasBlank(n)) {\n attributes_1.rr_dataURL = n.toDataURL(dataURLOptions.type, dataURLOptions.quality);\n }\n }\n else if (!('__context' in n)) {\n var canvasDataURL = n.toDataURL(dataURLOptions.type, dataURLOptions.quality);\n var blankCanvas = document.createElement('canvas');\n blankCanvas.width = n.width;\n blankCanvas.height = n.height;\n var blankCanvasDataURL = blankCanvas.toDataURL(dataURLOptions.type, dataURLOptions.quality);\n if (canvasDataURL !== blankCanvasDataURL) {\n attributes_1.rr_dataURL = canvasDataURL;\n }\n }\n }\n if (tagName === 'img' && inlineImages) {\n if (!canvasService) {\n canvasService = doc.createElement('canvas');\n canvasCtx = canvasService.getContext('2d');\n }\n var image_1 = n;\n var oldValue_1 = image_1.crossOrigin;\n image_1.crossOrigin = 'anonymous';\n var recordInlineImage = function () {\n try {\n canvasService.width = image_1.naturalWidth;\n canvasService.height = image_1.naturalHeight;\n canvasCtx.drawImage(image_1, 0, 0);\n attributes_1.rr_dataURL = canvasService.toDataURL(dataURLOptions.type, dataURLOptions.quality);\n }\n catch (err) {\n console.warn(\"Cannot inline img src=\" + image_1.currentSrc + \"! Error: \" + err);\n }\n oldValue_1\n ? (attributes_1.crossOrigin = oldValue_1)\n : delete attributes_1.crossOrigin;\n };\n if (image_1.complete && image_1.naturalWidth !== 0)\n recordInlineImage();\n else\n image_1.onload = recordInlineImage;\n }\n if (tagName === 'audio' || tagName === 'video') {\n attributes_1.rr_mediaState = n.paused\n ? 'paused'\n : 'played';\n attributes_1.rr_mediaCurrentTime = n.currentTime;\n }\n if (n.scrollLeft) {\n attributes_1.rr_scrollLeft = n.scrollLeft;\n }\n if (n.scrollTop) {\n attributes_1.rr_scrollTop = n.scrollTop;\n }\n if (needBlock || (tagName === 'img' && enableStrictPrivacy)) {\n var _f = n.getBoundingClientRect(), width = _f.width, height = _f.height;\n attributes_1 = {\n \"class\": attributes_1[\"class\"],\n rr_width: width + \"px\",\n rr_height: height + \"px\"\n };\n needBlock = true;\n }\n if (tagName === 'iframe' && !keepIframeSrcFn(attributes_1.src)) {\n if (!n.contentDocument) {\n attributes_1.rr_src = attributes_1.src;\n }\n delete attributes_1.src;\n }\n return {\n type: NodeType.Element,\n tagName: tagName,\n attributes: attributes_1,\n childNodes: [],\n isSVG: isSVGElement(n) || undefined,\n needBlock: needBlock,\n rootId: rootId\n };\n case n.TEXT_NODE:\n var parentTagName = n.parentNode && n.parentNode.tagName;\n var textContent = n.textContent;\n var isStyle = parentTagName === 'STYLE' ? true : undefined;\n var isScript = parentTagName === 'SCRIPT' ? true : undefined;\n var textContentHandled = false;\n if (isStyle && textContent) {\n try {\n if (n.nextSibling || n.previousSibling) {\n }\n else if ((_a = n.parentNode.sheet) === null || _a === void 0 ? void 0 : _a.cssRules) {\n textContent = stringifyStyleSheet(n.parentNode.sheet);\n }\n }\n catch (err) {\n console.warn(\"Cannot get CSS styles from text's parentNode. Error: \" + err, n);\n }\n textContent = absoluteToStylesheet(textContent, getHref());\n textContentHandled = true;\n }\n if (isScript) {\n textContent = 'SCRIPT_PLACEHOLDER';\n textContentHandled = true;\n }\n else if (parentTagName === 'NOSCRIPT') {\n textContent = '';\n textContentHandled = true;\n }\n if (!isStyle &&\n !isScript &&\n needMaskingText(n, maskTextClass, maskTextSelector) &&\n textContent) {\n textContent = maskTextFn\n ? maskTextFn(textContent)\n : textContent.replace(/[\\S]/g, '*');\n }\n if (enableStrictPrivacy && !textContentHandled && parentTagName) {\n var IGNORE_TAG_NAMES = new Set([\n 'HEAD',\n 'TITLE',\n 'STYLE',\n 'SCRIPT',\n 'HTML',\n 'BODY',\n 'NOSCRIPT',\n ]);\n if (!IGNORE_TAG_NAMES.has(parentTagName) && textContent) {\n textContent = obfuscateText(textContent);\n }\n }\n return {\n type: NodeType.Text,\n textContent: textContent || '',\n isStyle: isStyle,\n rootId: rootId\n };\n case n.CDATA_SECTION_NODE:\n return {\n type: NodeType.CDATA,\n textContent: '',\n rootId: rootId\n };\n case n.COMMENT_NODE:\n return {\n type: NodeType.Comment,\n textContent: n.textContent || '',\n rootId: rootId\n };\n default:\n return false;\n }\n}\nfunction lowerIfExists(maybeAttr) {\n if (maybeAttr === undefined) {\n return '';\n }\n else {\n return maybeAttr.toLowerCase();\n }\n}\nfunction slimDOMExcluded(sn, slimDOMOptions) {\n if (slimDOMOptions.comment && sn.type === NodeType.Comment) {\n return true;\n }\n else if (sn.type === NodeType.Element) {\n if (slimDOMOptions.script &&\n (sn.tagName === 'script' ||\n (sn.tagName === 'link' &&\n sn.attributes.rel === 'preload' &&\n sn.attributes.as === 'script') ||\n (sn.tagName === 'link' &&\n sn.attributes.rel === 'prefetch' &&\n typeof sn.attributes.href === 'string' &&\n sn.attributes.href.endsWith('.js')))) {\n return true;\n }\n else if (slimDOMOptions.headFavicon &&\n ((sn.tagName === 'link' && sn.attributes.rel === 'shortcut icon') ||\n (sn.tagName === 'meta' &&\n (lowerIfExists(sn.attributes.name).match(/^msapplication-tile(image|color)$/) ||\n lowerIfExists(sn.attributes.name) === 'application-name' ||\n lowerIfExists(sn.attributes.rel) === 'icon' ||\n lowerIfExists(sn.attributes.rel) === 'apple-touch-icon' ||\n lowerIfExists(sn.attributes.rel) === 'shortcut icon')))) {\n return true;\n }\n else if (sn.tagName === 'meta') {\n if (slimDOMOptions.headMetaDescKeywords &&\n lowerIfExists(sn.attributes.name).match(/^description|keywords$/)) {\n return true;\n }\n else if (slimDOMOptions.headMetaSocial &&\n (lowerIfExists(sn.attributes.property).match(/^(og|twitter|fb):/) ||\n lowerIfExists(sn.attributes.name).match(/^(og|twitter):/) ||\n lowerIfExists(sn.attributes.name) === 'pinterest')) {\n return true;\n }\n else if (slimDOMOptions.headMetaRobots &&\n (lowerIfExists(sn.attributes.name) === 'robots' ||\n lowerIfExists(sn.attributes.name) === 'googlebot' ||\n lowerIfExists(sn.attributes.name) === 'bingbot')) {\n return true;\n }\n else if (slimDOMOptions.headMetaHttpEquiv &&\n sn.attributes['http-equiv'] !== undefined) {\n return true;\n }\n else if (slimDOMOptions.headMetaAuthorship &&\n (lowerIfExists(sn.attributes.name) === 'author' ||\n lowerIfExists(sn.attributes.name) === 'generator' ||\n lowerIfExists(sn.attributes.name) === 'framework' ||\n lowerIfExists(sn.attributes.name) === 'publisher' ||\n lowerIfExists(sn.attributes.name) === 'progid' ||\n lowerIfExists(sn.attributes.property).match(/^article:/) ||\n lowerIfExists(sn.attributes.property).match(/^product:/))) {\n return true;\n }\n else if (slimDOMOptions.headMetaVerification &&\n (lowerIfExists(sn.attributes.name) === 'google-site-verification' ||\n lowerIfExists(sn.attributes.name) === 'yandex-verification' ||\n lowerIfExists(sn.attributes.name) === 'csrf-token' ||\n lowerIfExists(sn.attributes.name) === 'p:domain_verify' ||\n lowerIfExists(sn.attributes.name) === 'verify-v1' ||\n lowerIfExists(sn.attributes.name) === 'verification' ||\n lowerIfExists(sn.attributes.name) === 'shopify-checkout-api-token')) {\n return true;\n }\n }\n }\n return false;\n}\nfunction serializeNodeWithId(n, options) {\n var doc = options.doc, map = options.map, blockClass = options.blockClass, blockSelector = options.blockSelector, maskTextClass = options.maskTextClass, maskTextSelector = options.maskTextSelector, _a = options.skipChild, skipChild = _a === void 0 ? false : _a, _b = options.inlineStylesheet, inlineStylesheet = _b === void 0 ? true : _b, _c = options.maskInputOptions, maskInputOptions = _c === void 0 ? {} : _c, maskTextFn = options.maskTextFn, maskInputFn = options.maskInputFn, slimDOMOptions = options.slimDOMOptions, _d = options.dataURLOptions, dataURLOptions = _d === void 0 ? {} : _d, _e = options.inlineImages, inlineImages = _e === void 0 ? false : _e, _f = options.recordCanvas, recordCanvas = _f === void 0 ? false : _f, onSerialize = options.onSerialize, onIframeLoad = options.onIframeLoad, _g = options.iframeLoadTimeout, iframeLoadTimeout = _g === void 0 ? 5000 : _g, _h = options.keepIframeSrcFn, keepIframeSrcFn = _h === void 0 ? function () { return false; } : _h, enableStrictPrivacy = options.enableStrictPrivacy;\n var _j = options.preserveWhiteSpace, preserveWhiteSpace = _j === void 0 ? true : _j;\n var _serializedNode = serializeNode(n, {\n doc: doc,\n blockClass: blockClass,\n blockSelector: blockSelector,\n maskTextClass: maskTextClass,\n maskTextSelector: maskTextSelector,\n inlineStylesheet: inlineStylesheet,\n maskInputOptions: maskInputOptions,\n maskTextFn: maskTextFn,\n maskInputFn: maskInputFn,\n dataURLOptions: dataURLOptions,\n inlineImages: inlineImages,\n recordCanvas: recordCanvas,\n keepIframeSrcFn: keepIframeSrcFn,\n enableStrictPrivacy: enableStrictPrivacy\n });\n if (!_serializedNode) {\n console.warn(n, 'not serialized');\n return null;\n }\n var id;\n if ('__sn' in n) {\n id = n.__sn.id;\n }\n else if (slimDOMExcluded(_serializedNode, slimDOMOptions) ||\n (!preserveWhiteSpace &&\n _serializedNode.type === NodeType.Text &&\n !_serializedNode.isStyle &&\n !_serializedNode.textContent.replace(/^\\s+|\\s+$/gm, '').length)) {\n id = IGNORED_NODE;\n }\n else {\n id = genId();\n }\n var serializedNode = Object.assign(_serializedNode, { id: id });\n n.__sn = serializedNode;\n if (id === IGNORED_NODE) {\n return null;\n }\n map[id] = n;\n if (onSerialize) {\n onSerialize(n);\n }\n var recordChild = !skipChild;\n if (serializedNode.type === NodeType.Element) {\n recordChild = recordChild && !serializedNode.needBlock;\n if (serializedNode.needBlock && serializedNode.tagName === 'img') {\n var clone = n.cloneNode();\n clone.src = '';\n map[id] = clone;\n }\n delete serializedNode.needBlock;\n if (n.shadowRoot)\n serializedNode.isShadowHost = true;\n }\n if ((serializedNode.type === NodeType.Document ||\n serializedNode.type === NodeType.Element) &&\n recordChild) {\n if (slimDOMOptions.headWhitespace &&\n _serializedNode.type === NodeType.Element &&\n _serializedNode.tagName === 'head') {\n preserveWhiteSpace = false;\n }\n var bypassOptions = {\n doc: doc,\n map: map,\n blockClass: blockClass,\n blockSelector: blockSelector,\n maskTextClass: maskTextClass,\n maskTextSelector: maskTextSelector,\n skipChild: skipChild,\n inlineStylesheet: inlineStylesheet,\n maskInputOptions: maskInputOptions,\n maskTextFn: maskTextFn,\n maskInputFn: maskInputFn,\n slimDOMOptions: slimDOMOptions,\n dataURLOptions: dataURLOptions,\n inlineImages: inlineImages,\n recordCanvas: recordCanvas,\n preserveWhiteSpace: preserveWhiteSpace,\n onSerialize: onSerialize,\n onIframeLoad: onIframeLoad,\n iframeLoadTimeout: iframeLoadTimeout,\n keepIframeSrcFn: keepIframeSrcFn,\n enableStrictPrivacy: enableStrictPrivacy\n };\n for (var _i = 0, _k = Array.from(n.childNodes); _i < _k.length; _i++) {\n var childN = _k[_i];\n var serializedChildNode = serializeNodeWithId(childN, bypassOptions);\n if (serializedChildNode) {\n serializedNode.childNodes.push(serializedChildNode);\n }\n }\n if (isElement(n) && n.shadowRoot) {\n for (var _l = 0, _m = Array.from(n.shadowRoot.childNodes); _l < _m.length; _l++) {\n var childN = _m[_l];\n var serializedChildNode = serializeNodeWithId(childN, bypassOptions);\n if (serializedChildNode) {\n serializedChildNode.isShadow = true;\n serializedNode.childNodes.push(serializedChildNode);\n }\n }\n }\n }\n if (n.parentNode && isShadowRoot(n.parentNode)) {\n serializedNode.isShadow = true;\n }\n if (serializedNode.type === NodeType.Element &&\n serializedNode.tagName === 'iframe') {\n onceIframeLoaded(n, function () {\n var iframeDoc = n.contentDocument;\n if (iframeDoc && onIframeLoad) {\n var serializedIframeNode = serializeNodeWithId(iframeDoc, {\n doc: iframeDoc,\n map: map,\n blockClass: blockClass,\n blockSelector: blockSelector,\n maskTextClass: maskTextClass,\n maskTextSelector: maskTextSelector,\n skipChild: false,\n inlineStylesheet: inlineStylesheet,\n maskInputOptions: maskInputOptions,\n maskTextFn: maskTextFn,\n maskInputFn: maskInputFn,\n slimDOMOptions: slimDOMOptions,\n dataURLOptions: dataURLOptions,\n inlineImages: inlineImages,\n recordCanvas: recordCanvas,\n preserveWhiteSpace: preserveWhiteSpace,\n onSerialize: onSerialize,\n onIframeLoad: onIframeLoad,\n iframeLoadTimeout: iframeLoadTimeout,\n keepIframeSrcFn: keepIframeSrcFn,\n enableStrictPrivacy: enableStrictPrivacy\n });\n if (serializedIframeNode) {\n onIframeLoad(n, serializedIframeNode);\n }\n }\n }, iframeLoadTimeout);\n }\n return serializedNode;\n}\nfunction snapshot(n, options) {\n var _a = options || {}, _b = _a.blockClass, blockClass = _b === void 0 ? 'highlight-block' : _b, _c = _a.blockSelector, blockSelector = _c === void 0 ? null : _c, _d = _a.maskTextClass, maskTextClass = _d === void 0 ? 'highlight-mask' : _d, _e = _a.maskTextSelector, maskTextSelector = _e === void 0 ? null : _e, _f = _a.inlineStylesheet, inlineStylesheet = _f === void 0 ? true : _f, _g = _a.inlineImages, inlineImages = _g === void 0 ? false : _g, _h = _a.recordCanvas, recordCanvas = _h === void 0 ? false : _h, _j = _a.maskAllInputs, maskAllInputs = _j === void 0 ? false : _j, maskTextFn = _a.maskTextFn, maskInputFn = _a.maskInputFn, _k = _a.slimDOM, slimDOM = _k === void 0 ? false : _k, dataURLOptions = _a.dataURLOptions, preserveWhiteSpace = _a.preserveWhiteSpace, onSerialize = _a.onSerialize, onIframeLoad = _a.onIframeLoad, iframeLoadTimeout = _a.iframeLoadTimeout, _l = _a.keepIframeSrcFn, keepIframeSrcFn = _l === void 0 ? function () { return false; } : _l, _m = _a.enableStrictPrivacy, enableStrictPrivacy = _m === void 0 ? false : _m;\n var idNodeMap = {};\n var maskInputOptions = maskAllInputs === true\n ? {\n color: true,\n date: true,\n 'datetime-local': true,\n email: true,\n month: true,\n number: true,\n range: true,\n search: true,\n tel: true,\n text: true,\n time: true,\n url: true,\n week: true,\n textarea: true,\n select: true,\n password: true\n }\n : maskAllInputs === false\n ? {\n password: true\n }\n : maskAllInputs;\n var slimDOMOptions = slimDOM === true || slimDOM === 'all'\n ?\n {\n script: true,\n comment: true,\n headFavicon: true,\n headWhitespace: true,\n headMetaDescKeywords: slimDOM === 'all',\n headMetaSocial: true,\n headMetaRobots: true,\n headMetaHttpEquiv: true,\n headMetaAuthorship: true,\n headMetaVerification: true\n }\n : slimDOM === false\n ? {}\n : slimDOM;\n return [\n serializeNodeWithId(n, {\n doc: n,\n map: idNodeMap,\n blockClass: blockClass,\n blockSelector: blockSelector,\n maskTextClass: maskTextClass,\n maskTextSelector: maskTextSelector,\n skipChild: false,\n inlineStylesheet: inlineStylesheet,\n maskInputOptions: maskInputOptions,\n maskTextFn: maskTextFn,\n maskInputFn: maskInputFn,\n slimDOMOptions: slimDOMOptions,\n dataURLOptions: dataURLOptions,\n inlineImages: inlineImages,\n recordCanvas: recordCanvas,\n preserveWhiteSpace: preserveWhiteSpace,\n onSerialize: onSerialize,\n onIframeLoad: onIframeLoad,\n iframeLoadTimeout: iframeLoadTimeout,\n keepIframeSrcFn: keepIframeSrcFn,\n enableStrictPrivacy: enableStrictPrivacy\n }),\n idNodeMap,\n ];\n}\nfunction visitSnapshot(node, onVisit) {\n function walk(current) {\n onVisit(current);\n if (current.type === NodeType.Document ||\n current.type === NodeType.Element) {\n current.childNodes.forEach(walk);\n }\n }\n walk(node);\n}\nfunction cleanupSnapshot() {\n _id = 1;\n}\n\nvar commentre = /\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\//g;\nfunction parse(css, options) {\n if (options === void 0) { options = {}; }\n var lineno = 1;\n var column = 1;\n function updatePosition(str) {\n var lines = str.match(/\\n/g);\n if (lines) {\n lineno += lines.length;\n }\n var i = str.lastIndexOf('\\n');\n column = i === -1 ? column + str.length : str.length - i;\n }\n function position() {\n var start = { line: lineno, column: column };\n return function (node) {\n node.position = new Position(start);\n whitespace();\n return node;\n };\n }\n var Position = (function () {\n function Position(start) {\n this.start = start;\n this.end = { line: lineno, column: column };\n this.source = options.source;\n }\n return Position;\n }());\n Position.prototype.content = css;\n var errorsList = [];\n function error(msg) {\n var err = new Error(options.source + ':' + lineno + ':' + column + ': ' + msg);\n err.reason = msg;\n err.filename = options.source;\n err.line = lineno;\n err.column = column;\n err.source = css;\n if (options.silent) {\n errorsList.push(err);\n }\n else {\n throw err;\n }\n }\n function stylesheet() {\n var rulesList = rules();\n return {\n type: 'stylesheet',\n stylesheet: {\n source: options.source,\n rules: rulesList,\n parsingErrors: errorsList\n }\n };\n }\n function open() {\n return match(/^{\\s*/);\n }\n function close() {\n return match(/^}/);\n }\n function rules() {\n var node;\n var rules = [];\n whitespace();\n comments(rules);\n while (css.length && css.charAt(0) !== '}' && (node = atrule() || rule())) {\n if (node !== false) {\n rules.push(node);\n comments(rules);\n }\n }\n return rules;\n }\n function match(re) {\n var m = re.exec(css);\n if (!m) {\n return;\n }\n var str = m[0];\n updatePosition(str);\n css = css.slice(str.length);\n return m;\n }\n function whitespace() {\n match(/^\\s*/);\n }\n function comments(rules) {\n if (rules === void 0) { rules = []; }\n var c;\n while ((c = comment())) {\n if (c !== false) {\n rules.push(c);\n }\n c = comment();\n }\n return rules;\n }\n function comment() {\n var pos = position();\n if ('/' !== css.charAt(0) || '*' !== css.charAt(1)) {\n return;\n }\n var i = 2;\n while ('' !== css.charAt(i) &&\n ('*' !== css.charAt(i) || '/' !== css.charAt(i + 1))) {\n ++i;\n }\n i += 2;\n if ('' === css.charAt(i - 1)) {\n return error('End of comment missing');\n }\n var str = css.slice(2, i - 2);\n column += 2;\n updatePosition(str);\n css = css.slice(i);\n column += 2;\n return pos({\n type: 'comment',\n comment: str\n });\n }\n function selector() {\n var m = match(/^([^{]+)/);\n if (!m) {\n return;\n }\n return trim(m[0])\n .replace(/\\/\\*([^*]|[\\r\\n]|(\\*+([^*/]|[\\r\\n])))*\\*\\/+/g, '')\n .replace(/\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'/g, function (m) {\n return m.replace(/,/g, '\\u200C');\n })\n .split(/\\s*(?![^(]*\\)),\\s*/)\n .map(function (s) {\n return s.replace(/\\u200C/g, ',');\n });\n }\n function declaration() {\n var pos = position();\n var propMatch = match(/^(\\*?[-#\\/\\*\\\\\\w]+(\\[[0-9a-z_-]+\\])?)\\s*/);\n if (!propMatch) {\n return;\n }\n var prop = trim(propMatch[0]);\n if (!match(/^:\\s*/)) {\n return error(\"property missing ':'\");\n }\n var val = match(/^((?:'(?:\\\\'|.)*?'|\"(?:\\\\\"|.)*?\"|\\([^\\)]*?\\)|[^};])+)/);\n var ret = pos({\n type: 'declaration',\n property: prop.replace(commentre, ''),\n value: val ? trim(val[0]).replace(commentre, '') : ''\n });\n match(/^[;\\s]*/);\n return ret;\n }\n function declarations() {\n var decls = [];\n if (!open()) {\n return error(\"missing '{'\");\n }\n comments(decls);\n var decl;\n while ((decl = declaration())) {\n if (decl !== false) {\n decls.push(decl);\n comments(decls);\n }\n decl = declaration();\n }\n if (!close()) {\n return error(\"missing '}'\");\n }\n return decls;\n }\n function keyframe() {\n var m;\n var vals = [];\n var pos = position();\n while ((m = match(/^((\\d+\\.\\d+|\\.\\d+|\\d+)%?|[a-z]+)\\s*/))) {\n vals.push(m[1]);\n match(/^,\\s*/);\n }\n if (!vals.length) {\n return;\n }\n return pos({\n type: 'keyframe',\n values: vals,\n declarations: declarations()\n });\n }\n function atkeyframes() {\n var pos = position();\n var m = match(/^@([-\\w]+)?keyframes\\s*/);\n if (!m) {\n return;\n }\n var vendor = m[1];\n m = match(/^([-\\w]+)\\s*/);\n if (!m) {\n return error('@keyframes missing name');\n }\n var name = m[1];\n if (!open()) {\n return error(\"@keyframes missing '{'\");\n }\n var frame;\n var frames = comments();\n while ((frame = keyframe())) {\n frames.push(frame);\n frames = frames.concat(comments());\n }\n if (!close()) {\n return error(\"@keyframes missing '}'\");\n }\n return pos({\n type: 'keyframes',\n name: name,\n vendor: vendor,\n keyframes: frames\n });\n }\n function atsupports() {\n var pos = position();\n var m = match(/^@supports *([^{]+)/);\n if (!m) {\n return;\n }\n var supports = trim(m[1]);\n if (!open()) {\n return error(\"@supports missing '{'\");\n }\n var style = comments().concat(rules());\n if (!close()) {\n return error(\"@supports missing '}'\");\n }\n return pos({\n type: 'supports',\n supports: supports,\n rules: style\n });\n }\n function athost() {\n var pos = position();\n var m = match(/^@host\\s*/);\n if (!m) {\n return;\n }\n if (!open()) {\n return error(\"@host missing '{'\");\n }\n var style = comments().concat(rules());\n if (!close()) {\n return error(\"@host missing '}'\");\n }\n return pos({\n type: 'host',\n rules: style\n });\n }\n function atmedia() {\n var pos = position();\n var m = match(/^@media *([^{]+)/);\n if (!m) {\n return;\n }\n var media = trim(m[1]);\n if (!open()) {\n return error(\"@media missing '{'\");\n }\n var style = comments().concat(rules());\n if (!close()) {\n return error(\"@media missing '}'\");\n }\n return pos({\n type: 'media',\n media: media,\n rules: style\n });\n }\n function atcustommedia() {\n var pos = position();\n var m = match(/^@custom-media\\s+(--[^\\s]+)\\s*([^{;]+);/);\n if (!m) {\n return;\n }\n return pos({\n type: 'custom-media',\n name: trim(m[1]),\n media: trim(m[2])\n });\n }\n function atpage() {\n var pos = position();\n var m = match(/^@page */);\n if (!m) {\n return;\n }\n var sel = selector() || [];\n if (!open()) {\n return error(\"@page missing '{'\");\n }\n var decls = comments();\n var decl;\n while ((decl = declaration())) {\n decls.push(decl);\n decls = decls.concat(comments());\n }\n if (!close()) {\n return error(\"@page missing '}'\");\n }\n return pos({\n type: 'page',\n selectors: sel,\n declarations: decls\n });\n }\n function atdocument() {\n var pos = position();\n var m = match(/^@([-\\w]+)?document *([^{]+)/);\n if (!m) {\n return;\n }\n var vendor = trim(m[1]);\n var doc = trim(m[2]);\n if (!open()) {\n return error(\"@document missing '{'\");\n }\n var style = comments().concat(rules());\n if (!close()) {\n return error(\"@document missing '}'\");\n }\n return pos({\n type: 'document',\n document: doc,\n vendor: vendor,\n rules: style\n });\n }\n function atfontface() {\n var pos = position();\n var m = match(/^@font-face\\s*/);\n if (!m) {\n return;\n }\n if (!open()) {\n return error(\"@font-face missing '{'\");\n }\n var decls = comments();\n var decl;\n while ((decl = declaration())) {\n decls.push(decl);\n decls = decls.concat(comments());\n }\n if (!close()) {\n return error(\"@font-face missing '}'\");\n }\n return pos({\n type: 'font-face',\n declarations: decls\n });\n }\n var atimport = _compileAtrule('import');\n var atcharset = _compileAtrule('charset');\n var atnamespace = _compileAtrule('namespace');\n function _compileAtrule(name) {\n var re = new RegExp('^@' + name + '\\\\s*([^;]+);');\n return function () {\n var pos = position();\n var m = match(re);\n if (!m) {\n return;\n }\n var ret = { type: name };\n ret[name] = m[1].trim();\n return pos(ret);\n };\n }\n function atrule() {\n if (css[0] !== '@') {\n return;\n }\n return (atkeyframes() ||\n atmedia() ||\n atcustommedia() ||\n atsupports() ||\n atimport() ||\n atcharset() ||\n atnamespace() ||\n atdocument() ||\n atpage() ||\n athost() ||\n atfontface());\n }\n function rule() {\n var pos = position();\n var sel = selector();\n if (!sel) {\n return error('selector missing');\n }\n comments();\n return pos({\n type: 'rule',\n selectors: sel,\n declarations: declarations()\n });\n }\n return addParent(stylesheet());\n}\nfunction trim(str) {\n return str ? str.replace(/^\\s+|\\s+$/g, '') : '';\n}\nfunction addParent(obj, parent) {\n var isNode = obj && typeof obj.type === 'string';\n var childParent = isNode ? obj : parent;\n for (var _i = 0, _a = Object.keys(obj); _i < _a.length; _i++) {\n var k = _a[_i];\n var value = obj[k];\n if (Array.isArray(value)) {\n value.forEach(function (v) {\n addParent(v, childParent);\n });\n }\n else if (value && typeof value === 'object') {\n addParent(value, childParent);\n }\n }\n if (isNode) {\n Object.defineProperty(obj, 'parent', {\n configurable: true,\n writable: true,\n enumerable: false,\n value: parent || null\n });\n }\n return obj;\n}\n\nvar tagMap = {\n script: 'noscript',\n altglyph: 'altGlyph',\n altglyphdef: 'altGlyphDef',\n altglyphitem: 'altGlyphItem',\n animatecolor: 'animateColor',\n animatemotion: 'animateMotion',\n animatetransform: 'animateTransform',\n clippath: 'clipPath',\n feblend: 'feBlend',\n fecolormatrix: 'feColorMatrix',\n fecomponenttransfer: 'feComponentTransfer',\n fecomposite: 'feComposite',\n feconvolvematrix: 'feConvolveMatrix',\n fediffuselighting: 'feDiffuseLighting',\n fedisplacementmap: 'feDisplacementMap',\n fedistantlight: 'feDistantLight',\n fedropshadow: 'feDropShadow',\n feflood: 'feFlood',\n fefunca: 'feFuncA',\n fefuncb: 'feFuncB',\n fefuncg: 'feFuncG',\n fefuncr: 'feFuncR',\n fegaussianblur: 'feGaussianBlur',\n feimage: 'feImage',\n femerge: 'feMerge',\n femergenode: 'feMergeNode',\n femorphology: 'feMorphology',\n feoffset: 'feOffset',\n fepointlight: 'fePointLight',\n fespecularlighting: 'feSpecularLighting',\n fespotlight: 'feSpotLight',\n fetile: 'feTile',\n feturbulence: 'feTurbulence',\n foreignobject: 'foreignObject',\n glyphref: 'glyphRef',\n lineargradient: 'linearGradient',\n radialgradient: 'radialGradient'\n};\nfunction getTagName(n) {\n var tagName = tagMap[n.tagName] ? tagMap[n.tagName] : n.tagName;\n if (tagName === 'link' && n.attributes._cssText) {\n tagName = 'style';\n }\n return tagName;\n}\nfunction escapeRegExp(str) {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\nvar HOVER_SELECTOR = /([^\\\\]):hover/;\nvar HOVER_SELECTOR_GLOBAL = new RegExp(HOVER_SELECTOR.source, 'g');\nfunction addHoverClass(cssText, cache) {\n var _a;\n if (!((_a = window.HIG_CONFIGURATION) === null || _a === void 0 ? void 0 : _a.enableOnHoverClass)) {\n return cssText;\n }\n var cachedStyle = cache === null || cache === void 0 ? void 0 : cache.stylesWithHoverClass.get(cssText);\n if (cachedStyle)\n return cachedStyle;\n var ast = parse(cssText, {\n silent: true\n });\n if (!ast.stylesheet) {\n return cssText;\n }\n var selectors = [];\n ast.stylesheet.rules.forEach(function (rule) {\n if ('selectors' in rule) {\n (rule.selectors || []).forEach(function (selector) {\n if (HOVER_SELECTOR.test(selector)) {\n selectors.push(selector);\n }\n });\n }\n });\n if (selectors.length === 0) {\n return cssText;\n }\n var selectorMatcher = new RegExp(selectors\n .filter(function (selector, index) { return selectors.indexOf(selector) === index; })\n .sort(function (a, b) { return b.length - a.length; })\n .map(function (selector) {\n return escapeRegExp(selector);\n })\n .join('|'), 'g');\n var result = cssText.replace(selectorMatcher, function (selector) {\n var newSelector = selector.replace(HOVER_SELECTOR_GLOBAL, '$1.\\\\:hover');\n return selector + \", \" + newSelector;\n });\n cache === null || cache === void 0 ? void 0 : cache.stylesWithHoverClass.set(cssText, result);\n return result;\n}\nfunction createCache() {\n var stylesWithHoverClass = new Map();\n return {\n stylesWithHoverClass: stylesWithHoverClass\n };\n}\nfunction buildNode(n, options) {\n var doc = options.doc, hackCss = options.hackCss, cache = options.cache;\n switch (n.type) {\n case NodeType.Document:\n return doc.implementation.createDocument(null, '', null);\n case NodeType.DocumentType:\n return doc.implementation.createDocumentType(n.name || 'html', n.publicId, n.systemId);\n case NodeType.Element:\n var tagName = getTagName(n);\n var node_1;\n if (n.isSVG) {\n node_1 = doc.createElementNS('http://www.w3.org/2000/svg', tagName);\n }\n else {\n node_1 = doc.createElement(tagName);\n }\n var _loop_1 = function (name_1) {\n if (!n.attributes.hasOwnProperty(name_1)) {\n return \"continue\";\n }\n var value = n.attributes[name_1];\n if (tagName === 'option' && name_1 === 'selected' && value === false) {\n return \"continue\";\n }\n value =\n typeof value === 'boolean' || typeof value === 'number' ? '' : value;\n if (!name_1.startsWith('rr_')) {\n var isTextarea = tagName === 'textarea' && name_1 === 'value';\n var isRemoteOrDynamicCss = tagName === 'style' && name_1 === '_cssText';\n if (isRemoteOrDynamicCss && hackCss) {\n value = addHoverClass(value, cache);\n if (typeof value === 'string') {\n var regex = /url\\(\\\"https:\\/\\/\\S*(.eot|.woff2|.ttf|.woff)\\S*\\\"\\)/gm;\n var m = void 0;\n var fontUrls_1 = [];\n var PROXY_URL_1 = 'https://replay-cors-proxy.highlightrun.workers.dev';\n while ((m = regex.exec(value)) !== null) {\n if (m.index === regex.lastIndex) {\n regex.lastIndex++;\n }\n m.forEach(function (match, groupIndex) {\n if (groupIndex === 0) {\n var url = match.slice(5, match.length - 2);\n fontUrls_1.push({\n originalUrl: url,\n proxyUrl: url.replace(url, PROXY_URL_1 + \"?url=\" + url)\n });\n }\n });\n }\n fontUrls_1.forEach(function (urlPair) {\n value = value.replace(urlPair.originalUrl, urlPair.proxyUrl);\n });\n }\n }\n if (isTextarea || isRemoteOrDynamicCss) {\n var child = doc.createTextNode(value);\n for (var _i = 0, _a = Array.from(node_1.childNodes); _i < _a.length; _i++) {\n var c = _a[_i];\n if (c.nodeType === node_1.TEXT_NODE) {\n node_1.removeChild(c);\n }\n }\n node_1.appendChild(child);\n return \"continue\";\n }\n try {\n if (n.isSVG && name_1 === 'xlink:href') {\n node_1.setAttributeNS('http://www.w3.org/1999/xlink', name_1, value);\n }\n else if (name_1 === 'onload' ||\n name_1 === 'onclick' ||\n name_1.substring(0, 7) === 'onmouse') {\n node_1.setAttribute('_' + name_1, value);\n }\n else if (tagName === 'meta' &&\n n.attributes['http-equiv'] === 'Content-Security-Policy' &&\n name_1 === 'content') {\n node_1.setAttribute('csp-content', value);\n return \"continue\";\n }\n else if (tagName === 'link' &&\n n.attributes.rel === 'preload' &&\n n.attributes.as === 'script') {\n }\n else if (tagName === 'link' &&\n n.attributes.rel === 'prefetch' &&\n typeof n.attributes.href === 'string' &&\n n.attributes.href.endsWith('.js')) {\n }\n else if (tagName === 'img' &&\n n.attributes.srcset &&\n n.attributes.rr_dataURL) {\n node_1.setAttribute('rrweb-original-srcset', n.attributes.srcset);\n }\n else {\n node_1.setAttribute(name_1, value);\n }\n }\n catch (error) {\n }\n }\n else {\n if (tagName === 'canvas' && name_1 === 'rr_dataURL') {\n var image_1 = document.createElement('img');\n image_1.src = value;\n image_1.onload = function () {\n var ctx = node_1.getContext('2d');\n if (ctx) {\n ctx.drawImage(image_1, 0, 0, image_1.width, image_1.height);\n }\n };\n }\n else if (tagName === 'img' && name_1 === 'rr_dataURL') {\n var image = node_1;\n if (!image.currentSrc.startsWith('data:')) {\n image.setAttribute('rrweb-original-src', n.attributes.src);\n image.src = value;\n }\n }\n if (name_1 === 'rr_width') {\n node_1.style.width = value;\n }\n else if (name_1 === 'rr_height') {\n node_1.style.height = value;\n }\n else if (name_1 === 'rr_mediaCurrentTime') {\n node_1.currentTime = n.attributes\n .rr_mediaCurrentTime;\n }\n else if (name_1 === 'rr_mediaState') {\n switch (value) {\n case 'played':\n node_1\n .play()[\"catch\"](function (e) { return console.warn('media playback error', e); });\n break;\n case 'paused':\n node_1.pause();\n break;\n }\n }\n }\n };\n for (var name_1 in n.attributes) {\n _loop_1(name_1);\n }\n if (n.isShadowHost) {\n if (!node_1.shadowRoot) {\n node_1.attachShadow({ mode: 'open' });\n }\n else {\n while (node_1.shadowRoot.firstChild) {\n node_1.shadowRoot.removeChild(node_1.shadowRoot.firstChild);\n }\n }\n }\n return node_1;\n case NodeType.Text:\n return doc.createTextNode(n.isStyle && hackCss\n ? addHoverClass(n.textContent, cache)\n : n.textContent);\n case NodeType.CDATA:\n return doc.createCDATASection(n.textContent);\n case NodeType.Comment:\n return doc.createComment(n.textContent);\n default:\n return null;\n }\n}\nfunction buildNodeWithSN(n, options) {\n var doc = options.doc, map = options.map, _a = options.skipChild, skipChild = _a === void 0 ? false : _a, _b = options.hackCss, hackCss = _b === void 0 ? true : _b, afterAppend = options.afterAppend, cache = options.cache;\n var node = buildNode(n, { doc: doc, hackCss: hackCss, cache: cache });\n if (!node) {\n return null;\n }\n if (n.rootId) {\n console.assert(map[n.rootId] === doc, 'Target document should has the same root id.');\n }\n if (n.type === NodeType.Document) {\n doc.close();\n doc.open();\n if (n.compatMode === 'BackCompat' &&\n n.childNodes &&\n n.childNodes[0].type !== NodeType.DocumentType) {\n if (n.childNodes[0].type === NodeType.Element &&\n 'xmlns' in n.childNodes[0].attributes &&\n n.childNodes[0].attributes.xmlns === 'http://www.w3.org/1999/xhtml') {\n doc.write('<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"\">');\n }\n else {\n doc.write('<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"\">');\n }\n }\n node = doc;\n }\n node.__sn = n;\n map[n.id] = node;\n if ((n.type === NodeType.Document || n.type === NodeType.Element) &&\n !skipChild) {\n for (var _i = 0, _c = n.childNodes; _i < _c.length; _i++) {\n var childN = _c[_i];\n var childNode = buildNodeWithSN(childN, {\n doc: doc,\n map: map,\n skipChild: false,\n hackCss: hackCss,\n afterAppend: afterAppend,\n cache: cache\n });\n if (!childNode) {\n console.warn('Failed to rebuild', childN);\n continue;\n }\n if (childN.isShadow && isElement(node) && node.shadowRoot) {\n node.shadowRoot.appendChild(childNode);\n }\n else {\n node.appendChild(childNode);\n }\n if (afterAppend) {\n afterAppend(childNode);\n }\n }\n }\n return node;\n}\nfunction visit(idNodeMap, onVisit) {\n function walk(node) {\n onVisit(node);\n }\n for (var key in idNodeMap) {\n if (idNodeMap[key]) {\n walk(idNodeMap[key]);\n }\n }\n}\nfunction handleScroll(node) {\n var n = node.__sn;\n if (n.type !== NodeType.Element) {\n return;\n }\n var el = node;\n for (var name_2 in n.attributes) {\n if (!(n.attributes.hasOwnProperty(name_2) && name_2.startsWith('rr_'))) {\n continue;\n }\n var value = n.attributes[name_2];\n if (name_2 === 'rr_scrollLeft') {\n el.scrollLeft = value;\n }\n if (name_2 === 'rr_scrollTop') {\n el.scrollTop = value;\n }\n }\n}\nfunction rebuild(n, options) {\n var doc = options.doc, onVisit = options.onVisit, _a = options.hackCss, hackCss = _a === void 0 ? true : _a, afterAppend = options.afterAppend, cache = options.cache;\n var idNodeMap = {};\n var node = buildNodeWithSN(n, {\n doc: doc,\n map: idNodeMap,\n skipChild: false,\n hackCss: hackCss,\n afterAppend: afterAppend,\n cache: cache\n });\n visit(idNodeMap, function (visitedNode) {\n if (onVisit) {\n onVisit(visitedNode);\n }\n handleScroll(visitedNode);\n });\n return [node, idNodeMap];\n}\n\nexport { IGNORED_NODE, NodeType, addHoverClass, buildNodeWithSN, cleanupSnapshot, createCache, is2DCanvasBlank, isElement, isShadowRoot, maskInputValue, needMaskingText, obfuscateText, rebuild, serializeNodeWithId, snapshot, transformAttribute, visitSnapshot };\n","import {\n Mirror,\n throttleOptions,\n listenerHandler,\n hookResetter,\n blockClass,\n IncrementalSource,\n addedNodeMutation,\n removedNodeMutation,\n textMutation,\n attributeMutation,\n mutationData,\n scrollData,\n inputData,\n DocumentDimension,\n IWindow,\n} from './types';\nimport {\n INode,\n IGNORED_NODE,\n serializedNodeWithId,\n NodeType,\n isShadowRoot,\n} from '@highlight-run/rrweb-snapshot';\n\nexport function on(\n type: string,\n fn: EventListenerOrEventListenerObject,\n target: Document | IWindow = document,\n): listenerHandler {\n const options = { capture: true, passive: true };\n target.addEventListener(type, fn, options);\n return () => target.removeEventListener(type, fn, options);\n}\n\nexport function createMirror(): Mirror {\n return {\n map: {},\n getId(n) {\n // if n is not a serialized INode, use -1 as its id.\n if (!n || !n.__sn) {\n return -1;\n }\n return n.__sn.id;\n },\n getNode(id) {\n return this.map[id] || null;\n },\n // TODO: use a weakmap to get rid of manually memory management\n removeNodeFromMap(n) {\n const id = n.__sn && n.__sn.id;\n delete this.map[id];\n if (n.childNodes) {\n n.childNodes.forEach((child) =>\n this.removeNodeFromMap((child as Node) as INode),\n );\n }\n },\n has(id) {\n return this.map.hasOwnProperty(id);\n },\n reset() {\n this.map = {};\n },\n };\n}\n\n// https://github.com/rrweb-io/rrweb/pull/407\nconst DEPARTED_MIRROR_ACCESS_WARNING =\n 'Please stop import mirror directly. Instead of that,' +\n '\\r\\n' +\n 'now you can use replayer.getMirror() to access the mirror instance of a replayer,' +\n '\\r\\n' +\n 'or you can use record.mirror to access the mirror instance during recording.';\nexport let _mirror: Mirror = {\n map: {},\n getId() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n return -1;\n },\n getNode() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n return null;\n },\n removeNodeFromMap() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n },\n has() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n return false;\n },\n reset() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n },\n};\nif (typeof window !== 'undefined' && window.Proxy && window.Reflect) {\n _mirror = new Proxy(_mirror, {\n get(target, prop, receiver) {\n if (prop === 'map') {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n }\n return Reflect.get(target, prop, receiver);\n },\n });\n}\n\n// copy from underscore and modified\nexport function throttle<T>(\n func: (arg: T) => void,\n wait: number,\n options: throttleOptions = {},\n) {\n let timeout: ReturnType<typeof setTimeout> | null = null;\n let previous = 0;\n // tslint:disable-next-line: only-arrow-functions\n return function (arg: T) {\n let now = Date.now();\n if (!previous && options.leading === false) {\n previous = now;\n }\n let remaining = wait - (now - previous);\n let context = this;\n let args = arguments;\n if (remaining <= 0 || remaining > wait) {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n previous = now;\n func.apply(context, args);\n } else if (!timeout && options.trailing !== false) {\n timeout = setTimeout(() => {\n previous = options.leading === false ? 0 : Date.now();\n timeout = null;\n func.apply(context, args);\n }, remaining);\n }\n };\n}\n\nexport function hookSetter<T>(\n target: T,\n key: string | number | symbol,\n d: PropertyDescriptor,\n isRevoked?: boolean,\n win = window,\n): hookResetter {\n const original = win.Object.getOwnPropertyDescriptor(target, key);\n win.Object.defineProperty(\n target,\n key,\n isRevoked\n ? d\n : {\n set(value) {\n // put hooked setter into event loop to avoid of set latency\n setTimeout(() => {\n d.set!.call(this, value);\n }, 0);\n if (original && original.set) {\n original.set.call(this, value);\n }\n },\n },\n );\n return () => hookSetter(target, key, original || {}, true);\n}\n\n// copy from https://github.com/getsentry/sentry-javascript/blob/b2109071975af8bf0316d3b5b38f519bdaf5dc15/packages/utils/src/object.ts\nexport function patch(\n // tslint:disable-next-line:no-any\n source: { [key: string]: any },\n name: string,\n // tslint:disable-next-line:no-any\n replacement: (...args: any[]) => any,\n): () => void {\n try {\n if (!(name in source)) {\n return () => {};\n }\n\n const original = source[name] as () => unknown;\n const wrapped = replacement(original);\n\n // Make sure it's a function first, as we need to attach an empty prototype for `defineProperties` to work\n // otherwise it'll throw \"TypeError: Object.defineProperties called on non-object\"\n // tslint:disable-next-line:strict-type-predicates\n if (typeof wrapped === 'function') {\n wrapped.prototype = wrapped.prototype || {};\n Object.defineProperties(wrapped, {\n __rrweb_original__: {\n enumerable: false,\n value: original,\n },\n });\n }\n\n source[name] = wrapped;\n\n return () => {\n source[name] = original;\n };\n } catch {\n return () => {};\n // This can throw if multiple fill happens on a global object like XMLHttpRequest\n // Fixes https://github.com/getsentry/sentry-javascript/issues/2043\n }\n}\n\nexport function getWindowHeight(): number {\n return (\n window.innerHeight ||\n (document.documentElement && document.documentElement.clientHeight) ||\n (document.body && document.body.clientHeight)\n );\n}\n\nexport function getWindowWidth(): number {\n return (\n window.innerWidth ||\n (document.documentElement && document.documentElement.clientWidth) ||\n (document.body && document.body.clientWidth)\n );\n}\n\n/**\n * Start of Highlight Code\n */\nexport const isCanvasNode = (node: Node | null): boolean => {\n try {\n if (node instanceof HTMLElement) {\n return node.tagName === 'CANVAS';\n }\n } catch {\n return false;\n }\n return false;\n};\n/**\n * End of Highlight Code\n */\n\nexport function isBlocked(node: Node | null, blockClass: blockClass): boolean {\n if (!node) {\n return false;\n }\n if (node.nodeType === node.ELEMENT_NODE) {\n let needBlock = false;\n if (typeof blockClass === 'string') {\n if ((node as HTMLElement).closest !== undefined) {\n return (node as HTMLElement).closest('.' + blockClass) !== null;\n } else {\n needBlock = (node as HTMLElement).classList.contains(blockClass);\n }\n } else {\n (node as HTMLElement).classList.forEach((className) => {\n if (blockClass.test(className)) {\n needBlock = true;\n }\n });\n }\n return needBlock || isBlocked(node.parentNode, blockClass);\n }\n if (node.nodeType === node.TEXT_NODE) {\n // check parent node since text node do not have class name\n return isBlocked(node.parentNode, blockClass);\n }\n return isBlocked(node.parentNode, blockClass);\n}\n\nexport function isIgnored(n: Node | INode): boolean {\n if ('__sn' in n) {\n return (n as INode).__sn.id === IGNORED_NODE;\n }\n // The main part of the slimDOM check happens in\n // rrweb-snapshot::serializeNodeWithId\n return false;\n}\n\nexport function isAncestorRemoved(target: INode, mirror: Mirror): boolean {\n if (isShadowRoot(target)) {\n return false;\n }\n const id = mirror.getId(target);\n if (!mirror.has(id)) {\n return true;\n }\n if (\n target.parentNode &&\n target.parentNode.nodeType === target.DOCUMENT_NODE\n ) {\n return false;\n }\n // if the root is not document, it means the node is not in the DOM tree anymore\n if (!target.parentNode) {\n return true;\n }\n return isAncestorRemoved((target.parentNode as unknown) as INode, mirror);\n}\n\nexport function isTouchEvent(\n event: MouseEvent | TouchEvent,\n): event is TouchEvent {\n return Boolean((event as TouchEvent).changedTouches);\n}\n\nexport function polyfill(win = window) {\n if ('NodeList' in win && !win.NodeList.prototype.forEach) {\n win.NodeList.prototype.forEach = (Array.prototype\n .forEach as unknown) as NodeList['forEach'];\n }\n\n if ('DOMTokenList' in win && !win.DOMTokenList.prototype.forEach) {\n win.DOMTokenList.prototype.forEach = (Array.prototype\n .forEach as unknown) as DOMTokenList['forEach'];\n }\n\n // https://github.com/Financial-Times/polyfill-service/pull/183\n if (!Node.prototype.contains) {\n Node.prototype.contains = function contains(node) {\n if (!(0 in arguments)) {\n throw new TypeError('1 argument is required');\n }\n\n do {\n if (this === node) {\n return true;\n }\n // tslint:disable-next-line: no-conditional-assignment\n } while ((node = node && node.parentNode));\n\n return false;\n };\n }\n}\n\nexport type TreeNode = {\n id: number;\n mutation: addedNodeMutation;\n parent?: TreeNode;\n children: Record<number, TreeNode>;\n texts: textMutation[];\n attributes: attributeMutation[];\n};\nexport class TreeIndex {\n public tree!: Record<number, TreeNode>;\n\n private removeNodeMutations!: removedNodeMutation[];\n private textMutations!: textMutation[];\n private attributeMutations!: attributeMutation[];\n private indexes!: Map<number, TreeNode>;\n private removeIdSet!: Set<number>;\n private scrollMap!: Map<number, scrollData>;\n private inputMap!: Map<number, inputData>;\n\n constructor() {\n this.reset();\n }\n\n public add(mutation: addedNodeMutation) {\n const parentTreeNode = this.indexes.get(mutation.parentId);\n const treeNode: TreeNode = {\n id: mutation.node.id,\n mutation,\n children: [],\n texts: [],\n attributes: [],\n };\n if (!parentTreeNode) {\n this.tree[treeNode.id] = treeNode;\n } else {\n treeNode.parent = parentTreeNode;\n parentTreeNode.children[treeNode.id] = treeNode;\n }\n this.indexes.set(treeNode.id, treeNode);\n }\n\n public remove(mutation: removedNodeMutation, mirror: Mirror) {\n const parentTreeNode = this.indexes.get(mutation.parentId);\n const treeNode = this.indexes.get(mutation.id);\n\n const deepRemoveFromMirror = (id: number) => {\n this.removeIdSet.add(id);\n const node = mirror.getNode(id);\n node?.childNodes.forEach((childNode) => {\n if ('__sn' in childNode) {\n deepRemoveFromMirror(((childNode as unknown) as INode).__sn.id);\n }\n });\n };\n const deepRemoveFromTreeIndex = (node: TreeNode) => {\n this.removeIdSet.add(node.id);\n Object.values(node.children).forEach((n) => deepRemoveFromTreeIndex(n));\n const _treeNode = this.indexes.get(node.id);\n if (_treeNode) {\n const _parentTreeNode = _treeNode.parent;\n if (_parentTreeNode) {\n delete _treeNode.parent;\n delete _parentTreeNode.children[_treeNode.id];\n this.indexes.delete(mutation.id);\n }\n }\n };\n\n if (!treeNode) {\n this.removeNodeMutations.push(mutation);\n deepRemoveFromMirror(mutation.id);\n } else if (!parentTreeNode) {\n delete this.tree[treeNode.id];\n this.indexes.delete(treeNode.id);\n deepRemoveFromTreeIndex(treeNode);\n } else {\n delete treeNode.parent;\n delete parentTreeNode.children[treeNode.id];\n this.indexes.delete(mutation.id);\n deepRemoveFromTreeIndex(treeNode);\n }\n }\n\n public text(mutation: textMutation) {\n const treeNode = this.indexes.get(mutation.id);\n if (treeNode) {\n treeNode.texts.push(mutation);\n } else {\n this.textMutations.push(mutation);\n }\n }\n\n public attribute(mutation: attributeMutation) {\n const treeNode = this.indexes.get(mutation.id);\n if (treeNode) {\n treeNode.attributes.push(mutation);\n } else {\n this.attributeMutations.push(mutation);\n }\n }\n\n public scroll(d: scrollData) {\n this.scrollMap.set(d.id, d);\n }\n\n public input(d: inputData) {\n this.inputMap.set(d.id, d);\n }\n\n public flush(): {\n mutationData: mutationData;\n scrollMap: TreeIndex['scrollMap'];\n inputMap: TreeIndex['inputMap'];\n } {\n const {\n tree,\n removeNodeMutations,\n textMutations,\n attributeMutations,\n } = this;\n\n const batchMutationData: mutationData = {\n source: IncrementalSource.Mutation,\n removes: removeNodeMutations,\n texts: textMutations,\n attributes: attributeMutations,\n adds: [],\n };\n\n const walk = (treeNode: TreeNode, removed: boolean) => {\n if (removed) {\n this.removeIdSet.add(treeNode.id);\n }\n batchMutationData.texts = batchMutationData.texts\n .concat(removed ? [] : treeNode.texts)\n .filter((m) => !this.removeIdSet.has(m.id));\n batchMutationData.attributes = batchMutationData.attributes\n .concat(removed ? [] : treeNode.attributes)\n .filter((m) => !this.removeIdSet.has(m.id));\n if (\n !this.removeIdSet.has(treeNode.id) &&\n !this.removeIdSet.has(treeNode.mutation.parentId) &&\n !removed\n ) {\n batchMutationData.adds.push(treeNode.mutation);\n if (treeNode.children) {\n Object.values(treeNode.children).forEach((n) => walk(n, false));\n }\n } else {\n Object.values(treeNode.children).forEach((n) => walk(n, true));\n }\n };\n\n Object.values(tree).forEach((n) => walk(n, false));\n\n for (const id of this.scrollMap.keys()) {\n if (this.removeIdSet.has(id)) {\n this.scrollMap.delete(id);\n }\n }\n for (const id of this.inputMap.keys()) {\n if (this.removeIdSet.has(id)) {\n this.inputMap.delete(id);\n }\n }\n\n const scrollMap = new Map(this.scrollMap);\n const inputMap = new Map(this.inputMap);\n\n this.reset();\n\n return {\n mutationData: batchMutationData,\n scrollMap,\n inputMap,\n };\n }\n\n private reset() {\n this.tree = [];\n this.indexes = new Map();\n this.removeNodeMutations = [];\n this.textMutations = [];\n this.attributeMutations = [];\n this.removeIdSet = new Set();\n this.scrollMap = new Map();\n this.inputMap = new Map();\n }\n\n public idRemoved(id: number): boolean {\n return this.removeIdSet.has(id);\n }\n}\n\ntype ResolveTree = {\n value: addedNodeMutation;\n children: ResolveTree[];\n parent: ResolveTree | null;\n};\n\nexport function queueToResolveTrees(queue: addedNodeMutation[]): ResolveTree[] {\n const queueNodeMap: Record<number, ResolveTree> = {};\n const putIntoMap = (\n m: addedNodeMutation,\n parent: ResolveTree | null,\n ): ResolveTree => {\n const nodeInTree: ResolveTree = {\n value: m,\n parent,\n children: [],\n };\n queueNodeMap[m.node.id] = nodeInTree;\n return nodeInTree;\n };\n\n const queueNodeTrees: ResolveTree[] = [];\n for (const mutation of queue) {\n const { nextId, parentId } = mutation;\n if (nextId && nextId in queueNodeMap) {\n const nextInTree = queueNodeMap[nextId];\n if (nextInTree.parent) {\n const idx = nextInTree.parent.children.indexOf(nextInTree);\n nextInTree.parent.children.splice(\n idx,\n 0,\n putIntoMap(mutation, nextInTree.parent),\n );\n } else {\n const idx = queueNodeTrees.indexOf(nextInTree);\n queueNodeTrees.splice(idx, 0, putIntoMap(mutation, null));\n }\n continue;\n }\n if (parentId in queueNodeMap) {\n const parentInTree = queueNodeMap[parentId];\n parentInTree.children.push(putIntoMap(mutation, parentInTree));\n continue;\n }\n queueNodeTrees.push(putIntoMap(mutation, null));\n }\n\n return queueNodeTrees;\n}\n\nexport function iterateResolveTree(\n tree: ResolveTree,\n cb: (mutation: addedNodeMutation) => unknown,\n) {\n cb(tree.value);\n /**\n * The resolve tree was designed to reflect the DOM layout,\n * but we need append next sibling first, so we do a reverse\n * loop here.\n */\n for (let i = tree.children.length - 1; i >= 0; i--) {\n iterateResolveTree(tree.children[i], cb);\n }\n}\n\ntype HTMLIFrameINode = HTMLIFrameElement & {\n __sn: serializedNodeWithId;\n};\nexport type AppendedIframe = {\n mutationInQueue: addedNodeMutation;\n builtNode: HTMLIFrameINode;\n};\n\nexport function isIframeINode(\n node: INode | ShadowRoot,\n): node is HTMLIFrameINode {\n if ('__sn' in node) {\n return (\n node.__sn.type === NodeType.Element && node.__sn.tagName === 'iframe'\n );\n }\n // node can be document fragment when using the virtual parent feature\n return false;\n}\n\nexport function getBaseDimension(\n node: Node,\n rootIframe: Node,\n): DocumentDimension {\n const frameElement = node.ownerDocument?.defaultView?.frameElement;\n if (!frameElement || frameElement === rootIframe) {\n return {\n x: 0,\n y: 0,\n relativeScale: 1,\n absoluteScale: 1,\n };\n }\n\n const frameDimension = frameElement.getBoundingClientRect();\n const frameBaseDimension = getBaseDimension(frameElement, rootIframe);\n // the iframe element may have a scale transform\n const relativeScale = frameDimension.height / frameElement.clientHeight;\n return {\n x:\n frameDimension.x * frameBaseDimension.relativeScale +\n frameBaseDimension.x,\n y:\n frameDimension.y * frameBaseDimension.relativeScale +\n frameBaseDimension.y,\n relativeScale,\n absoluteScale: frameBaseDimension.absoluteScale * relativeScale,\n };\n}\n\nexport function hasShadowRoot<T extends Node>(\n n: T,\n): n is T & { shadowRoot: ShadowRoot } {\n return Boolean(((n as unknown) as Element)?.shadowRoot);\n}\n","// tslint:disable\n/**\n * Class StackFrame is a fork of https://github.com/stacktracejs/stackframe/blob/master/stackframe.js\n * I fork it because:\n * 1. There are some build issues when importing this package.\n * 2. Rewrites into typescript give us a better type interface.\n * 3. StackFrame contains some functions we don't need.\n */\nexport class StackFrame {\n private fileName: string;\n private functionName: string;\n private lineNumber?: number;\n private columnNumber?: number;\n\n constructor(obj: {\n fileName?: string;\n functionName?: string;\n lineNumber?: number;\n columnNumber?: number;\n }) {\n this.fileName = obj.fileName || '';\n this.functionName = obj.functionName || '';\n this.lineNumber = obj.lineNumber;\n this.columnNumber = obj.columnNumber;\n }\n\n toString() {\n const lineNumber = this.lineNumber || '';\n const columnNumber = this.columnNumber || '';\n if (this.functionName) {\n return (\n this.functionName +\n ' (' +\n this.fileName +\n ':' +\n lineNumber +\n ':' +\n columnNumber +\n ')'\n );\n }\n return this.fileName + ':' + lineNumber + ':' + columnNumber;\n }\n}\n\n/**\n * ErrorStackParser is a fork of https://github.com/stacktracejs/error-stack-parser/blob/master/error-stack-parser.js\n * I fork it because:\n * 1. There are some build issues when importing this package.\n * 2. Rewrites into typescript give us a better type interface.\n */\nconst FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\\S+:\\d+/;\nconst CHROME_IE_STACK_REGEXP = /^\\s*at .*(\\S+:\\d+|\\(native\\))/m;\nconst SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\\[native code])?$/;\nexport const ErrorStackParser = {\n /**\n * Given an Error object, extract the most information from it.\n *\n * @param {Error} error object\n * @return {Array} of StackFrames\n */\n parse: function (error: Error): StackFrame[] {\n // https://github.com/rrweb-io/rrweb/issues/782\n if (!error) {\n return [];\n }\n if (\n // @ts-ignore\n typeof error.stacktrace !== 'undefined' ||\n // @ts-ignore\n typeof error['opera#sourceloc'] !== 'undefined'\n ) {\n return this.parseOpera(\n error as {\n stacktrace?: string;\n message: string;\n stack?: string;\n },\n );\n } else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {\n return this.parseV8OrIE(error as { stack: string });\n } else if (error.stack) {\n return this.parseFFOrSafari(error as { stack: string });\n } else {\n throw new Error('Cannot parse given Error object');\n }\n },\n // Separate line and column numbers from a string of the form: (URI:Line:Column)\n extractLocation: function (urlLike: string) {\n // Fail-fast but return locations like \"(native)\"\n if (urlLike.indexOf(':') === -1) {\n return [urlLike];\n }\n\n const regExp = /(.+?)(?::(\\d+))?(?::(\\d+))?$/;\n const parts = regExp.exec(urlLike.replace(/[()]/g, ''));\n if (!parts) throw new Error(`Cannot parse given url: ${urlLike}`);\n return [parts[1], parts[2] || undefined, parts[3] || undefined];\n },\n parseV8OrIE: function (error: { stack: string }) {\n const filtered = error.stack.split('\\n').filter(function (line) {\n return !!line.match(CHROME_IE_STACK_REGEXP);\n }, this);\n\n return filtered.map(function (line) {\n if (line.indexOf('(eval ') > -1) {\n // Throw away eval information until we implement stacktrace.js/stackframe#8\n line = line\n .replace(/eval code/g, 'eval')\n .replace(/(\\(eval at [^()]*)|(\\),.*$)/g, '');\n }\n let sanitizedLine = line.replace(/^\\s+/, '').replace(/\\(eval code/g, '(');\n\n // capture and preseve the parenthesized location \"(/foo/my bar.js:12:87)\" in\n // case it has spaces in it, as the string is split on \\s+ later on\n const location = sanitizedLine.match(/ (\\((.+):(\\d+):(\\d+)\\)$)/);\n\n // remove the parenthesized location from the line, if it was matched\n sanitizedLine = location\n ? sanitizedLine.replace(location[0], '')\n : sanitizedLine;\n\n const tokens = sanitizedLine.split(/\\s+/).slice(1);\n // if a location was matched, pass it to extractLocation() otherwise pop the last token\n const locationParts = this.extractLocation(\n location ? location[1] : tokens.pop(),\n );\n const functionName = tokens.join(' ') || undefined;\n const fileName =\n ['eval', '<anonymous>'].indexOf(locationParts[0]) > -1\n ? undefined\n : locationParts[0];\n\n return new StackFrame({\n functionName,\n fileName,\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n });\n }, this);\n },\n parseFFOrSafari: function (error: { stack: string }) {\n const filtered = error.stack.split('\\n').filter(function (line) {\n return !line.match(SAFARI_NATIVE_CODE_REGEXP);\n }, this);\n\n return filtered.map(function (line) {\n // Throw away eval information until we implement stacktrace.js/stackframe#8\n if (line.indexOf(' > eval') > -1) {\n line = line.replace(\n / line (\\d+)(?: > eval line \\d+)* > eval:\\d+:\\d+/g,\n ':$1',\n );\n }\n\n if (line.indexOf('@') === -1 && line.indexOf(':') === -1) {\n // Safari eval frames only have function names and nothing else\n return new StackFrame({\n functionName: line,\n });\n } else {\n const functionNameRegex = /((.*\".+\"[^@]*)?[^@]*)(?:@)/;\n const matches = line.match(functionNameRegex);\n const functionName = matches && matches[1] ? matches[1] : undefined;\n const locationParts = this.extractLocation(\n line.replace(functionNameRegex, ''),\n );\n\n return new StackFrame({\n functionName,\n fileName: locationParts[0],\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n });\n }\n }, this);\n },\n parseOpera: function (e: {\n stacktrace?: string;\n message: string;\n stack?: string;\n }): StackFrame[] {\n if (\n !e.stacktrace ||\n (e.message.indexOf('\\n') > -1 &&\n e.message.split('\\n').length > e.stacktrace.split('\\n').length)\n ) {\n return this.parseOpera9(e as { message: string });\n } else if (!e.stack) {\n return this.parseOpera10(e as { stacktrace: string });\n } else {\n return this.parseOpera11(e as { stack: string });\n }\n },\n parseOpera9: function (e: { message: string }) {\n const lineRE = /Line (\\d+).*script (?:in )?(\\S+)/i;\n const lines = e.message.split('\\n');\n const result = [];\n\n for (let i = 2, len = lines.length; i < len; i += 2) {\n const match = lineRE.exec(lines[i]);\n if (match) {\n result.push(\n new StackFrame({\n fileName: match[2],\n lineNumber: parseFloat(match[1]),\n }),\n );\n }\n }\n\n return result;\n },\n parseOpera10: function (e: { stacktrace: string }) {\n const lineRE = /Line (\\d+).*script (?:in )?(\\S+)(?:: In function (\\S+))?$/i;\n const lines = e.stacktrace.split('\\n');\n const result = [];\n\n for (let i = 0, len = lines.length; i < len; i += 2) {\n const match = lineRE.exec(lines[i]);\n if (match) {\n result.push(\n new StackFrame({\n functionName: match[3] || undefined,\n fileName: match[2],\n lineNumber: parseFloat(match[1]),\n }),\n );\n }\n }\n\n return result;\n },\n // Opera 10.65+ Error.stack very similar to FF/Safari\n parseOpera11: function (error: { stack: string }) {\n const filtered = error.stack.split('\\n').filter(function (line) {\n return (\n !!line.match(FIREFOX_SAFARI_STACK_REGEXP) &&\n !line.match(/^Error created at/)\n );\n }, this);\n\n return filtered.map(function (line: string) {\n const tokens = line.split('@');\n const locationParts = this.extractLocation(tokens.pop());\n const functionCall = tokens.shift() || '';\n const functionName =\n functionCall\n .replace(/<anonymous function(: (\\w+))?>/, '$2')\n .replace(/\\([^)]*\\)/g, '') || undefined;\n return new StackFrame({\n functionName,\n fileName: locationParts[0],\n lineNumber: locationParts[1],\n columnNumber: locationParts[2],\n });\n }, this);\n },\n};\n","// tslint:disable:no-any no-bitwise forin\n/**\n * this file is used to serialize log message to string\n *\n */\n\nimport { StringifyOptions } from './index';\n\n/**\n * transfer the node path in Event to string\n * @param node the first node in a node path array\n */\nfunction pathToSelector(node: HTMLElement): string | '' {\n if (!node || !node.outerHTML) {\n return '';\n }\n\n let path = '';\n while (node.parentElement) {\n let name = node.localName;\n if (!name) {\n break;\n }\n name = name.toLowerCase();\n let parent = node.parentElement;\n\n let domSiblings = [];\n\n if (parent.children && parent.children.length > 0) {\n // tslint:disable-next-line:prefer-for-of\n for (let i = 0; i < parent.children.length; i++) {\n let sibling = parent.children[i];\n if (sibling.localName && sibling.localName.toLowerCase) {\n if (sibling.localName.toLowerCase() === name) {\n domSiblings.push(sibling);\n }\n }\n }\n }\n\n if (domSiblings.length > 1) {\n name += ':eq(' + domSiblings.indexOf(node) + ')';\n }\n path = name + (path ? '>' + path : '');\n node = parent;\n }\n\n return path;\n}\n\n/**\n * judge is object\n */\nfunction isObject(obj: any): boolean {\n return Object.prototype.toString.call(obj) === '[object Object]';\n}\n\n/**\n * judge the object's depth\n */\nfunction isObjTooDeep(obj: any, limit: number): boolean {\n if (limit === 0) {\n return true;\n }\n\n const keys = Object.keys(obj);\n for (const key of keys) {\n if (isObject(obj[key]) && isObjTooDeep(obj[key], limit - 1)) {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * stringify any js object\n * @param obj the object to stringify\n */\nexport function stringify(\n obj: any,\n stringifyOptions?: StringifyOptions,\n): string {\n const options: StringifyOptions = {\n numOfKeysLimit: 50,\n depthOfLimit: 4,\n };\n Object.assign(options, stringifyOptions);\n const stack: any[] = [];\n const keys: any[] = [];\n return JSON.stringify(obj, function (key, value) {\n /**\n * forked from https://github.com/moll/json-stringify-safe/blob/master/stringify.js\n * to deCycle the object\n */\n if (stack.length > 0) {\n const thisPos = stack.indexOf(this);\n ~thisPos ? stack.splice(thisPos + 1) : stack.push(this);\n ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);\n if (~stack.indexOf(value)) {\n if (stack[0] === value) {\n value = '[Circular ~]';\n } else {\n value =\n '[Circular ~.' +\n keys.slice(0, stack.indexOf(value)).join('.') +\n ']';\n }\n }\n } else {\n stack.push(value);\n }\n /* END of the FORK */\n\n if (value === null || value === undefined) {\n return value;\n }\n if (shouldIgnore(value)) {\n return toString(value);\n }\n if (value instanceof Event) {\n const eventResult: any = {};\n for (const eventKey in value) {\n const eventValue = (value as any)[eventKey];\n if (Array.isArray(eventValue)) {\n eventResult[eventKey] = pathToSelector(\n eventValue.length ? eventValue[0] : null,\n );\n } else {\n eventResult[eventKey] = eventValue;\n }\n }\n return eventResult;\n } else if (value instanceof Node) {\n if (value instanceof HTMLElement) {\n return value ? value.outerHTML : '';\n }\n return value.nodeName;\n } else if (value instanceof Error) {\n return value.stack\n ? value.stack + '\\nEnd of stack for Error object'\n : value.name + ': ' + value.message;\n }\n return value;\n });\n\n /**\n * whether we should ignore obj's info and call toString() function instead\n */\n function shouldIgnore(_obj: object): boolean {\n // outof keys limit\n if (isObject(_obj) && Object.keys(_obj).length > options.numOfKeysLimit) {\n return true;\n }\n\n // is function\n if (typeof _obj === 'function') {\n return true;\n }\n\n /**\n * judge object's depth to avoid browser's OOM\n *\n * issues: https://github.com/rrweb-io/rrweb/issues/653\n */\n if (isObject(_obj) && isObjTooDeep(_obj, options.depthOfLimit)) {\n return true;\n }\n\n return false;\n }\n\n /**\n * limit the toString() result according to option\n */\n function toString(_obj: object): string {\n let str = _obj.toString();\n if (options.stringLengthLimit && str.length > options.stringLengthLimit) {\n str = `${str.slice(0, options.stringLengthLimit)}...`;\n }\n return str;\n }\n}\n","import { listenerHandler, RecordPlugin, IWindow } from '../../../types';\nimport { patch } from '../../../utils';\nimport { ErrorStackParser, StackFrame } from './error-stack-parser';\nimport { stringify } from './stringify';\n\nexport type StringifyOptions = {\n // limit of string length\n stringLengthLimit?: number;\n /**\n * limit of number of keys in an object\n * if an object contains more keys than this limit, we would call its toString function directly\n */\n numOfKeysLimit: number;\n /**\n * limit number of depth in an object\n * if an object is too deep, toString process may cause browser OOM\n */\n depthOfLimit: number;\n};\n\ntype LogRecordOptions = {\n level?: LogLevel[];\n lengthThreshold?: number;\n stringifyOptions?: StringifyOptions;\n logger?: Logger | 'console';\n};\n\nconst defaultLogOptions: LogRecordOptions = {\n level: [\n 'assert',\n 'clear',\n 'count',\n 'countReset',\n 'debug',\n 'dir',\n 'dirxml',\n 'error',\n 'group',\n 'groupCollapsed',\n 'groupEnd',\n 'info',\n 'log',\n 'table',\n 'time',\n 'timeEnd',\n 'timeLog',\n 'trace',\n 'warn',\n ],\n lengthThreshold: 1000,\n logger: 'console',\n};\n\nexport type LogData = {\n level: LogLevel;\n trace: string[];\n payload: string[];\n};\n\ntype logCallback = (p: LogData) => void;\n\nexport type LogLevel =\n | 'assert'\n | 'clear'\n | 'count'\n | 'countReset'\n | 'debug'\n | 'dir'\n | 'dirxml'\n | 'error'\n | 'group'\n | 'groupCollapsed'\n | 'groupEnd'\n | 'info'\n | 'log'\n | 'table'\n | 'time'\n | 'timeEnd'\n | 'timeLog'\n | 'trace'\n | 'warn';\n\n/* fork from interface Console */\n// all kinds of console functions\nexport type Logger = {\n assert?: typeof console.assert;\n clear?: typeof console.clear;\n count?: typeof console.count;\n countReset?: typeof console.countReset;\n debug?: typeof console.debug;\n dir?: typeof console.dir;\n dirxml?: typeof console.dirxml;\n error?: typeof console.error;\n group?: typeof console.group;\n groupCollapsed?: typeof console.groupCollapsed;\n groupEnd?: () => void;\n info?: typeof console.info;\n log?: typeof console.log;\n table?: typeof console.table;\n time?: typeof console.time;\n timeEnd?: typeof console.timeEnd;\n timeLog?: typeof console.timeLog;\n trace?: typeof console.trace;\n warn?: typeof console.warn;\n};\n\nfunction initLogObserver(\n cb: logCallback,\n win: IWindow, // top window or in an iframe\n logOptions: LogRecordOptions,\n): listenerHandler {\n const loggerType = logOptions.logger;\n if (!loggerType) {\n return () => {};\n }\n let logger: Logger;\n if (typeof loggerType === 'string') {\n logger = win[loggerType];\n } else {\n logger = loggerType;\n }\n let logCount = 0;\n const cancelHandlers: listenerHandler[] = [];\n // add listener to thrown errors\n if (logOptions.level!.includes('error')) {\n if (window) {\n const errorHandler = (event: ErrorEvent) => {\n const { message, error } = event;\n const trace: string[] = ErrorStackParser.parse(\n error,\n ).map((stackFrame: StackFrame) => stackFrame.toString());\n const payload = [stringify(message, logOptions.stringifyOptions)];\n cb({\n level: 'error',\n trace,\n payload,\n });\n };\n window.addEventListener('error', errorHandler);\n cancelHandlers.push(() => {\n if (window) window.removeEventListener('error', errorHandler);\n });\n }\n }\n for (const levelType of logOptions.level!) {\n cancelHandlers.push(replace(logger, levelType));\n }\n return () => {\n cancelHandlers.forEach((h) => h());\n };\n\n /**\n * replace the original console function and record logs\n * @param logger the logger object such as Console\n * @param level the name of log function to be replaced\n */\n function replace(_logger: Logger, level: LogLevel) {\n if (!_logger[level]) {\n return () => {};\n }\n // replace the logger.{level}. return a restore function\n return patch(_logger, level, (original) => {\n return (...args: Array<unknown>) => {\n original.apply(this, args);\n try {\n const trace = ErrorStackParser.parse(new Error())\n .map((stackFrame: StackFrame) => stackFrame.toString())\n .splice(1); // splice(1) to omit the hijacked log function\n const payload = args.map((s) =>\n stringify(s, logOptions.stringifyOptions),\n );\n logCount++;\n if (logCount < logOptions.lengthThreshold!) {\n cb({\n level,\n trace,\n payload,\n });\n } else if (logCount === logOptions.lengthThreshold) {\n // notify the user\n cb({\n level: 'warn',\n trace: [],\n payload: [\n stringify('The number of log records reached the threshold.'),\n ],\n });\n }\n } catch (error) {\n original('rrweb logger error:', error, ...args);\n }\n };\n });\n }\n}\n\nexport const PLUGIN_NAME = 'rrweb/console@1';\n\nexport const getRecordConsolePlugin: (\n options?: LogRecordOptions,\n) => RecordPlugin = (options) => ({\n name: PLUGIN_NAME,\n observer: initLogObserver,\n options: options\n ? Object.assign({}, defaultLogOptions, options)\n : defaultLogOptions,\n});\n"],"names":["__values","o","s","Symbol","iterator","m","i","call","length","next","value","done","TypeError","__read","n","r","e","ar","push","error","__spreadArray","to","from","pack","arguments","l","Array","prototype","slice","concat","EventType","IncrementalSource","MouseInteractions","CanvasContext","MediaInteractions","ReplayerEvents","NodeType","DEPARTED_MIRROR_ACCESS_WARNING","_mirror","map","getId","console","getNode","removeNodeFromMap","has","reset","window","Proxy","Reflect","get","target","prop","receiver","obj","this","fileName","functionName","lineNumber","columnNumber","StackFrame","FIREFOX_SAFARI_STACK_REGEXP","CHROME_IE_STACK_REGEXP","SAFARI_NATIVE_CODE_REGEXP","ErrorStackParser","parse","stacktrace","parseOpera","stack","match","parseV8OrIE","parseFFOrSafari","Error","extractLocation","urlLike","indexOf","parts","exec","replace","undefined","split","filter","line","sanitizedLine","location","tokens","locationParts","pop","join","functionNameRegex","matches","message","parseOpera9","parseOpera11","parseOpera10","lineRE","lines","result","len","parseFloat","shift","pathToSelector","node","outerHTML","path","parentElement","name_1","localName","toLowerCase","parent_1","domSiblings","children","sibling","isObject","Object","toString","isObjTooDeep","limit","keys","keys_1","key","stringify","stringifyOptions","options","numOfKeysLimit","depthOfLimit","assign","JSON","thisPos","splice","Infinity","_obj","shouldIgnore","str","stringLengthLimit","Event","eventResult","eventKey","eventValue","isArray","Node","HTMLElement","nodeName","name","defaultLogOptions","level","lengthThreshold","logger","initLogObserver","cb","win","logOptions","loggerType","logCount","cancelHandlers","includes","errorHandler_1","event","trace","stackFrame","payload","addEventListener","removeEventListener","_b","levelType","forEach","h","_logger","source","replacement","original_1","wrapped","defineProperties","__rrweb_original__","enumerable","patch","original","_i","args","apply","_this","PLUGIN_NAME","observer"],"mappings":";;;;;;;;;;;;;;oFAuHO,SAASA,EAASC,GACrB,IAAIC,EAAsB,mBAAX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